From 057adb04f18f319dafeecd2e4294dd090c8360d1 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 2 Dec 2021 12:21:33 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6990) --- ...e-event-to-allow-plugins-to-handle-clien.patch | 15 ++++++++------- ...client-protocol-version-and-virtual-host.patch | 4 ++-- ...tion-desync-in-playerconnection-causing-.patch | 4 ++-- patches/server/0631-Add-bypass-host-check.patch | 8 ++++---- .../0664-Add-Unix-domain-socket-support.patch | 6 +++--- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/patches/server/0086-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/server/0086-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 9ba4220ae..20d6ec745 100644 --- a/patches/server/0086-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/patches/server/0086-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -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! + } + } -+ // Don't try and handle default logic if it's been handled by the event. -+ if (!handledByEvent && proxyLogicEnabled) { -+ // Paper end // Spigot Start + String[] split = packet.hostName.split("\00"); - if (org.spigotmc.SpigotConfig.bungee) { -+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - String[] split = packet.hostName.split("\00"); ++ // Don't try and handle default logic if it's been handled by the event. ++ if (!handledByEvent && proxyLogicEnabled) { ++ // Paper end ++ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! 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()); diff --git a/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch index 70cde445e..f2242c662 100644 --- a/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0161-Expose-client-protocol-version-and-virtual-host.patch @@ -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()); } diff --git a/patches/server/0446-Prevent-position-desync-in-playerconnection-causing-.patch b/patches/server/0446-Prevent-position-desync-in-playerconnection-causing-.patch index 3cd6a724c..a79dfde02 100644 --- a/patches/server/0446-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/patches/server/0446-Prevent-position-desync-in-playerconnection-causing-.patch @@ -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. diff --git a/patches/server/0631-Add-bypass-host-check.patch b/patches/server/0631-Add-bypass-host-check.patch index 80d7b918c..a9a87f8a7 100644 --- a/patches/server/0631-Add-bypass-host-check.patch +++ b/patches/server/0631-Add-bypass-host-check.patch @@ -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 (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - String[] split = packet.hostName.split("\00"); + if (!handledByEvent && proxyLogicEnabled) { + // Paper end + // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - 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]; diff --git a/patches/server/0664-Add-Unix-domain-socket-support.patch b/patches/server/0664-Add-Unix-domain-socket-support.patch index 687dd8ace..35fbd12a4 100644 --- a/patches/server/0664-Add-Unix-domain-socket-support.patch +++ b/patches/server/0664-Add-Unix-domain-socket-support.patch @@ -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 - //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - String[] split = packet.hostName.split("\00"); + // Paper end + // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! 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(); diff --git a/work/Bukkit b/work/Bukkit index fc0fe0555..f023e77ad 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit fc0fe05559f00c0ef5c45d9140097c0622368b90 +Subproject commit f023e77ad7343fa11812d3118efc956b67cdd242 diff --git a/work/CraftBukkit b/work/CraftBukkit index a0087010a..581df1846 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit a0087010ac0475f8dbc57ef3f9b4a83cbbcc0f39 +Subproject commit 581df1846f2b3e09b20e71fd44851f3e68f1f7db diff --git a/work/Spigot b/work/Spigot index a5dea1cbc..3c40a6c90 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit a5dea1cbca6d941f1980dcc92102af7081d0b0f5 +Subproject commit 3c40a6c908b0a67b05ebf8f5268d64838e117d41