From 9e51f949417553240efe35719e5173edfd5a8dc1 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 7 May 2024 05:24:45 -0700 Subject: [PATCH] Fix ping event always receiving protocol version 0 (#10671) --- ...-Expose-client-protocol-version-and-virtual-host.patch | 8 ++++---- ...54-Configurable-connection-throttle-kick-message.patch | 4 ++-- ...Fix-hex-colors-not-working-in-some-kick-messages.patch | 4 ++-- patches/server/0523-Add-bypass-host-check.patch | 4 ++-- patches/server/0552-Add-Unix-domain-socket-support.patch | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch index 6f1694b0be..99dcb0e80f 100644 --- a/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0157-Expose-client-protocol-version-and-virtual-host.patch @@ -75,11 +75,11 @@ index 0ccfdceea8e211c595be2dad2392876109b4eeef..1321b9adba4c9e45dce0f717d44a7cb4 // Paper start - add utility methods public final net.minecraft.server.level.ServerPlayer getPlayer() { diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 9214fb6b8e21ff6aee8be0691f1fe6e41c901ba3..644214cc3a3c8e560b6ce470fe5997e3c10a2e3d 100644 +index 9214fb6b8e21ff6aee8be0691f1fe6e41c901ba3..65333e0244d7c3c415266f1740929761ca890af7 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -181,6 +181,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - // Spigot End +@@ -69,6 +69,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + throw new UnsupportedOperationException("Invalid intention " + String.valueOf(packet.intention())); } + // Paper start - NetworkClient implementation @@ -88,7 +88,7 @@ index 9214fb6b8e21ff6aee8be0691f1fe6e41c901ba3..644214cc3a3c8e560b6ce470fe5997e3 + // Paper end } - @Override + private void beginLogin(ClientIntentionPacket packet, boolean transfer) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index a9922e5f5c19cd6455b6ca9a3db7aa0a42f99524..7e1f6e23980f12786abaa4218d8d77dd1a8feb3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/patches/server/0254-Configurable-connection-throttle-kick-message.patch b/patches/server/0254-Configurable-connection-throttle-kick-message.patch index 45bfe1972e..4da61fc469 100644 --- a/patches/server/0254-Configurable-connection-throttle-kick-message.patch +++ b/patches/server/0254-Configurable-connection-throttle-kick-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 644214cc3a3c8e560b6ce470fe5997e3c10a2e3d..bc15794e0a3909ab9ceeded35158bea4c23fb45a 100644 +index 65333e0244d7c3c415266f1740929761ca890af7..f9314bee1ed9b0e4c4591c0acf8a305721765850 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -82,7 +82,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -86,7 +86,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); diff --git a/patches/server/0414-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0414-Fix-hex-colors-not-working-in-some-kick-messages.patch index 0f9bba490b..05d525bde0 100644 --- a/patches/server/0414-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/0414-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix hex colors not working in some kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index bc15794e0a3909ab9ceeded35158bea4c23fb45a..bcdb2cc4c735d939bdd0e9b7ec5246f51e57f299 100644 +index f9314bee1ed9b0e4c4591c0acf8a305721765850..ffe3048d16809b177d2fb495a25a16ed78b50e6b 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -108,14 +108,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -112,14 +112,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL } // CraftBukkit end if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) { diff --git a/patches/server/0523-Add-bypass-host-check.patch b/patches/server/0523-Add-bypass-host-check.patch index 8c40f13437..d6c893d808 100644 --- a/patches/server/0523-Add-bypass-host-check.patch +++ b/patches/server/0523-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 bcdb2cc4c735d939bdd0e9b7ec5246f51e57f299..6a33cb47c5dac403ad90ef95a56b99a6869e0459 100644 +index ffe3048d16809b177d2fb495a25a16ed78b50e6b..b5d8ef9dd24687b99f5cf547574351c359fb85ba 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -31,6 +31,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -19,7 +19,7 @@ index bcdb2cc4c735d939bdd0e9b7ec5246f51e57f299..6a33cb47c5dac403ad90ef95a56b99a6 public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) { this.server = server; -@@ -159,7 +160,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -163,7 +164,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL String[] split = packet.hostName().split("\00"); if (!handledByEvent && proxyLogicEnabled) { // Paper // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! diff --git a/patches/server/0552-Add-Unix-domain-socket-support.patch b/patches/server/0552-Add-Unix-domain-socket-support.patch index 413dd25508..dba2363807 100644 --- a/patches/server/0552-Add-Unix-domain-socket-support.patch +++ b/patches/server/0552-Add-Unix-domain-socket-support.patch @@ -103,10 +103,10 @@ index a2a4f30ed2a524fc8b86e0ffbc9d6aa49e557e44..1a6dd2cf5bd02c328fb9ac80ec74be97 } // Spigot End diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 6a33cb47c5dac403ad90ef95a56b99a6869e0459..a57235284cfa2d289b601a53415b205d4193a243 100644 +index b5d8ef9dd24687b99f5cf547574351c359fb85ba..45a2683c9489bee6d67a1f3d702c17f2e9dc02e4 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -76,6 +76,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -80,6 +80,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND); // CraftBukkit start - Connection throttle try { @@ -114,7 +114,7 @@ index 6a33cb47c5dac403ad90ef95a56b99a6869e0459..a57235284cfa2d289b601a53415b205d long currentTime = System.currentTimeMillis(); long connectionThrottle = this.server.server.getConnectionThrottle(); InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); -@@ -104,6 +105,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -108,6 +109,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL } } } @@ -122,7 +122,7 @@ index 6a33cb47c5dac403ad90ef95a56b99a6869e0459..a57235284cfa2d289b601a53415b205d } catch (Throwable t) { org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); } -@@ -161,8 +163,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL +@@ -165,8 +167,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL if (!handledByEvent && proxyLogicEnabled) { // Paper // 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 - Add bypass host check