Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6990)

This commit is contained in:
Jake Potrebic 2021-12-02 12:21:33 -08:00 committed by GitHub
parent 956124f86a
commit 057adb04f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 21 deletions

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 94d0111f35cb025024da10e2fb4ea0cb802d4ff2..c4ba069f5124ec151e05813beddf293fddc3b804 100644
index 02613b1f36ecd7f354ac00022af3c193b299c1b1..27d304316bec097fea4b950cb4e0ac80cb219f70 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -88,8 +88,35 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -88,9 +88,36 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
this.connection.disconnect(chatmessage);
} else {
this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection));
@ -37,12 +37,13 @@ index 94d0111f35cb025024da10e2fb4ea0cb802d4ff2..c4ba069f5124ec151e05813beddf293f
+ handledByEvent = true; // Hooray, we did it!
+ }
+ }
// Spigot Start
String[] split = packet.hostName.split("\00");
- if (org.spigotmc.SpigotConfig.bungee) {
+ // Don't try and handle default logic if it's been handled by the event.
+ if (!handledByEvent && proxyLogicEnabled) {
+ // Paper end
// Spigot Start
- if (org.spigotmc.SpigotConfig.bungee) {
+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
String[] split = packet.hostName.split("\00");
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
packet.hostName = split[0];
connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());

View File

@ -75,10 +75,10 @@ index 7d177d38f3311ab941dd126c844d22e0018e25a1..84fe0f6cfc928d95d0967ad368a38afb
public Connection(PacketFlow side) {
this.receiving = side;
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index c4ba069f5124ec151e05813beddf293fddc3b804..484221e5a9c246aa91e0eacef3911b0e9ecff401 100644
index 27d304316bec097fea4b950cb4e0ac80cb219f70..85fea9b0bf84a8b40098f35eac503070914c98d8 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -150,6 +150,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -155,6 +155,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
throw new UnsupportedOperationException("Invalid intention " + packet.getIntention());
}

View File

@ -14,13 +14,13 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bb1244d895c6e5fd668b5a01f507624fdac847f0..fec9551ef74c17be417a326847cc20b0ad54076b 100644
index 2dcbee2e13141aff6b22e5ba1746c73592d9803c..3cd080bdf22a2fa4e9a1904a0e10325098621d7a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1324,6 +1324,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
this.player.setOnGround(packet.isOnGround()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
+ // Paper start - prevent position desync
+ if (this.awaitingPositionFromClient != null) {
+ return; // ... thanks Mojang for letting move calls teleport across dimensions.

View File

@ -8,7 +8,7 @@ Paper.bypassHostCheck
Seriously, fix your firewalls. -.-
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 2384ae5082afd01c4f28fe2f3f782cdce15ff3f2..4c44f06ba18cfa2d889d0dd57fdd7eb79971c8c6 100644
index 54de844431cf9cc88d6e82014d5eb69babd7784c..b5b929a504164aefd2498cd9fad66a5c7aaf59e4 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -20,9 +20,9 @@ index 2384ae5082afd01c4f28fe2f3f782cdce15ff3f2..4c44f06ba18cfa2d889d0dd57fdd7eb7
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
this.server = server;
@@ -118,7 +119,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
// Spigot Start
if (!handledByEvent && proxyLogicEnabled) {
// Paper end
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
String[] split = packet.hostName.split("\00");
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
packet.hostName = split[0];

View File

@ -107,7 +107,7 @@ index 940b52e0b22b009f819de0dc05436a1820390bde..f7aa0125e4724f1efddf28814f926289
}
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 4c44f06ba18cfa2d889d0dd57fdd7eb79971c8c6..e0cd786f130e34b3401d40663e1548fc0076f74a 100644
index b5b929a504164aefd2498cd9fad66a5c7aaf59e4..97ee159867c4800c8fdec9a5fa42f648112be186 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -44,6 +44,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@ -127,8 +127,8 @@ index 4c44f06ba18cfa2d889d0dd57fdd7eb79971c8c6..e0cd786f130e34b3401d40663e1548fc
org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
}
@@ -120,8 +122,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
// Paper end
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
String[] split = packet.hostName.split("\00");
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper
+ // Paper start - Unix domain socket support
+ java.net.SocketAddress socketAddress = connection.getRemoteAddress();

@ -1 +1 @@
Subproject commit fc0fe05559f00c0ef5c45d9140097c0622368b90
Subproject commit f023e77ad7343fa11812d3118efc956b67cdd242

@ -1 +1 @@
Subproject commit a0087010ac0475f8dbc57ef3f9b4a83cbbcc0f39
Subproject commit 581df1846f2b3e09b20e71fd44851f3e68f1f7db

@ -1 +1 @@
Subproject commit a5dea1cbca6d941f1980dcc92102af7081d0b0f5
Subproject commit 3c40a6c908b0a67b05ebf8f5268d64838e117d41