summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-12-12 11:19:31 +1100
committermd_5 <git@md-5.net>2018-12-12 11:19:31 +1100
commita3c2ec03148f9f38d4d27d045b1afee2fc6ff173 (patch)
tree7da4920e70fbc59ce7c4f8b178d72c7b3b7695a8
parent7fa173e6d18e848f04534fe87d22a05be016fda1 (diff)
downloadcraftbukkit-a3c2ec03148f9f38d4d27d045b1afee2fc6ff173.tar
craftbukkit-a3c2ec03148f9f38d4d27d045b1afee2fc6ff173.tar.gz
craftbukkit-a3c2ec03148f9f38d4d27d045b1afee2fc6ff173.tar.lz
craftbukkit-a3c2ec03148f9f38d4d27d045b1afee2fc6ff173.tar.xz
craftbukkit-a3c2ec03148f9f38d4d27d045b1afee2fc6ff173.zip
Fix missing ServerListPingEvent call for legacy pings
-rw-r--r--nms-patches/LegacyPingHandler.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/nms-patches/LegacyPingHandler.patch b/nms-patches/LegacyPingHandler.patch
new file mode 100644
index 00000000..98526ece
--- /dev/null
+++ b/nms-patches/LegacyPingHandler.patch
@@ -0,0 +1,34 @@
+--- a/net/minecraft/server/LegacyPingHandler.java
++++ b/net/minecraft/server/LegacyPingHandler.java
+@@ -34,11 +34,12 @@
+ MinecraftServer minecraftserver = this.b.d();
+ int i = bytebuf.readableBytes();
+ String s;
++ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()); // CraftBukkit
+
+ switch (i) {
+ case 0:
+ LegacyPingHandler.a.debug("Ping: (<1.3.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
+- s = String.format("%s\u00a7%d\u00a7%d", new Object[] { minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
++ s = String.format("%s\u00a7%d\u00a7%d", new Object[] { event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
+ this.a(channelhandlercontext, this.a(s));
+ break;
+ case 1:
+@@ -47,7 +48,7 @@
+ }
+
+ LegacyPingHandler.a.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
+- s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
++ s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
+ this.a(channelhandlercontext, this.a(s));
+ break;
+ default:
+@@ -66,7 +67,7 @@
+ }
+
+ LegacyPingHandler.a.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
+- String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), minecraftserver.getMotd(), minecraftserver.y(), minecraftserver.z()});
++ String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] { 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()}); // CraftBukkit
+ ByteBuf bytebuf1 = this.a(s1);
+
+ try {