diff --git a/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch b/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch index 1848f0220..4c78fc825 100644 --- a/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch +++ b/Spigot-Server-Patches/0347-Handle-Excessive-Signs-in-Chunks-creating-large-pack.patch @@ -1,4 +1,4 @@ -From 5e98ffe924abde6c9985464127a99fc2506fba12 Mon Sep 17 00:00:00 2001 +From 57f98e2c510b576b4d3c94b12384b1bc4b6b5e33 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 2 Mar 2019 14:55:01 -0500 Subject: [PATCH] Handle Excessive Signs in Chunks creating large packets @@ -14,30 +14,32 @@ With further contributions from Co-Authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index b1dededc15..ddc12364e7 100644 +index b1dededc15..e966b6edcc 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -158,19 +158,53 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -158,19 +158,55 @@ public class NetworkManager extends SimpleChannelInboundHandler> { NetworkManager.LOGGER.debug("Set listener of {} to {}", this, packetlistener); this.packetListener = packetlistener; } + // Paper start -+ private static java.util.List buildExtraPackets(Packet packet) { -+ java.util.List extra = packet.getExtraPackets(); -+ if (extra == null || extra.isEmpty()) { -+ return null; ++ private static class InnerUtil { // Attempt to hide these methods from ProtocolLib so it doesn't accidently pick them up. ++ private static java.util.List buildExtraPackets(Packet packet) { ++ java.util.List extra = packet.getExtraPackets(); ++ if (extra == null || extra.isEmpty()) { ++ return null; ++ } ++ java.util.List ret = new java.util.ArrayList<>(1 + extra.size()); ++ buildExtraPackets0(extra, ret); ++ return ret; + } -+ java.util.List ret = new java.util.ArrayList<>(1 + extra.size()); -+ buildExtraPackets0(extra, ret); -+ return ret; -+ } + -+ private static void buildExtraPackets0(java.util.List extraPackets, java.util.List into) { -+ for (Packet extra : extraPackets) { -+ into.add(extra); -+ java.util.List extraExtra = extra.getExtraPackets(); -+ if (extraExtra != null && !extraExtra.isEmpty()) { -+ buildExtraPackets0(extraExtra, into); ++ private static void buildExtraPackets0(java.util.List extraPackets, java.util.List into) { ++ for (Packet extra : extraPackets) { ++ into.add(extra); ++ java.util.List extraExtra = extra.getExtraPackets(); ++ if (extraExtra != null && !extraExtra.isEmpty()) { ++ buildExtraPackets0(extraExtra, into); ++ } + } + } + } @@ -52,9 +54,9 @@ index b1dededc15..ddc12364e7 100644 - this.o(); - this.b(packet, genericfuturelistener); - } else { -+ // Paper start start - handle oversized packets better ++ // Paper start - handle oversized packets better + // write the packets to the queue, then flush - antixray hooks there already -+ java.util.List extraPackets = buildExtraPackets(packet); ++ java.util.List extraPackets = InnerUtil.buildExtraPackets(packet); + boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty(); + if (!hasExtraPackets) { this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener)); diff --git a/Spigot-Server-Patches/0384-Anti-Xray.patch b/Spigot-Server-Patches/0384-Anti-Xray.patch index fe69b5068..0c8fc3984 100644 --- a/Spigot-Server-Patches/0384-Anti-Xray.patch +++ b/Spigot-Server-Patches/0384-Anti-Xray.patch @@ -1,4 +1,4 @@ -From f6be2f7be9bb53cabe1258d71f9dbc4ab92bcce6 Mon Sep 17 00:00:00 2001 +From 320c3f9937a0e870f32f6b1dc3cf5480004a7692 Mon Sep 17 00:00:00 2001 From: stonar96 Date: Mon, 20 Aug 2018 03:03:58 +0200 Subject: [PATCH] Anti-Xray @@ -1377,10 +1377,10 @@ index 2c1d1b1a55..44aed67274 100644 if (this.h == this.b) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index ddc12364e7..0b6dce35e6 100644 +index e966b6edcc..682434ec07 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -186,6 +186,11 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -188,6 +188,11 @@ public class NetworkManager extends SimpleChannelInboundHandler> { public void sendPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { // Paper start start - handle oversized packets better @@ -1390,9 +1390,9 @@ index ddc12364e7..0b6dce35e6 100644 + return; + } // write the packets to the queue, then flush - antixray hooks there already - java.util.List extraPackets = buildExtraPackets(packet); + java.util.List extraPackets = InnerUtil.buildExtraPackets(packet); boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty(); -@@ -248,21 +253,32 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -250,21 +255,32 @@ public class NetworkManager extends SimpleChannelInboundHandler> { }