aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch
new file mode 100644
index 0000000000..e985c493ff
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/network/LegacyQueryHandler.java.patch
@@ -0,0 +1,63 @@
+--- a/net/minecraft/server/network/LegacyQueryHandler.java
++++ b/net/minecraft/server/network/LegacyQueryHandler.java
+@@ -31,12 +32,15 @@
+ return;
+ }
+
+- SocketAddress socketAddress = context.channel().remoteAddress();
+- int i = byteBuf.readableBytes();
++ SocketAddress socketaddress = channelhandlercontext.channel().remoteAddress();
++ int i = bytebuf.readableBytes();
++ String s;
++ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(socketaddress, server.getMotd(), server.getPlayerCount(), server.getMaxPlayers()); // CraftBukkit
++
+ if (i == 0) {
+- LOGGER.debug("Ping: (<1.3.x) from {}", socketAddress);
+- String string = createVersion0Response(this.server);
+- sendFlushAndClose(context, createLegacyDisconnectPacket(context.alloc(), string));
++ LegacyQueryHandler.LOGGER.debug("Ping: (<1.3.x) from {}", socketaddress);
++ s = createVersion0Response(this.server, event); // CraftBukkit
++ sendFlushAndClose(channelhandlercontext, createLegacyDisconnectPacket(channelhandlercontext.alloc(), s));
+ } else {
+ if (byteBuf.readUnsignedByte() != 1) {
+ return;
+@@ -52,8 +56,8 @@
+ LOGGER.debug("Ping: (1.4-1.5.x) from {}", socketAddress);
+ }
+
+- String string = createVersion1Response(this.server);
+- sendFlushAndClose(context, createLegacyDisconnectPacket(context.alloc(), string));
++ s = createVersion1Response(this.server, event); // CraftBukkit
++ sendFlushAndClose(channelhandlercontext, createLegacyDisconnectPacket(channelhandlercontext.alloc(), s));
+ }
+
+ byteBuf.release();
+@@ -95,20 +107,16 @@
+ }
+ }
+
+- private static String createVersion0Response(ServerInfo serverInfo) {
+- return String.format(Locale.ROOT, "%s§%d§%d", serverInfo.getMotd(), serverInfo.getPlayerCount(), serverInfo.getMaxPlayers());
++ // CraftBukkit start
++ private static String createVersion0Response(ServerInfo serverinfo, org.bukkit.event.server.ServerListPingEvent event) {
++ return String.format(Locale.ROOT, "%s\u00a7%d\u00a7%d", event.getMotd(), event.getNumPlayers(), event.getMaxPlayers());
++ // CraftBukkit end
+ }
+
+- private static String createVersion1Response(ServerInfo serverInfo) {
+- return String.format(
+- Locale.ROOT,
+- "§1\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d",
+- 127,
+- serverInfo.getServerVersion(),
+- serverInfo.getMotd(),
+- serverInfo.getPlayerCount(),
+- serverInfo.getMaxPlayers()
+- );
++ // CraftBukkit start
++ private static String createVersion1Response(ServerInfo serverinfo, org.bukkit.event.server.ServerListPingEvent event) {
++ return String.format(Locale.ROOT, "\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, serverinfo.getServerVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers());
++ // CraftBukkit end
+ }
+
+ private static void sendFlushAndClose(ChannelHandlerContext channelHandlerContext, ByteBuf context) {