Fix ping event always receiving protocol version 0 (#10671)

This commit is contained in:
Jason Penilla 2024-05-07 05:24:45 -07:00 committed by GitHub
parent ac3a5471c8
commit 9e51f94941
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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);

View File

@ -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()) {

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 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!

View File

@ -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