diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index b866659..9cf32e8 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -95,10 +95,10 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166 .completer(new ConsoleCommandCompleter(this.server)) .option(LineReader.Option.COMPLETE_IN_WORD, true); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4e1011dca1081a5246981fabb93f142442dcc92c..75a19ba0863854026c0697a5ede0761e9ae70b56 100644 +index fa2b4cdd4c4e2c1df3e378a7c706f06c3361ad53..ac0000d7dbe732c96b853a6ed9e3636e23e6f2d0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1850,7 +1850,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -Date: Mon, 28 Mar 2022 17:02:21 -0400 +From: Telesphoreo +Date: Thu, 25 Jan 2024 23:48:51 -0600 Subject: [PATCH] Block server-side chunkbans diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index b5b228e67284baad3639b283595427a819bb1a44..617d7f41a57fb86620183b219f025bb8f747bcf8 100644 +index 85b8be8ffac0fb40e9cae0528271ed41473811c8..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -7,8 +7,16 @@ import io.netty.handler.codec.MessageToByteEncoder; +@@ -7,8 +7,17 @@ import io.netty.handler.codec.MessageToByteEncoder; import io.netty.util.Attribute; import io.netty.util.AttributeKey; import java.io.IOException; -+import java.util.Collections; // Scissors -+import net.minecraft.ChatFormatting; // Scissors -+import net.minecraft.core.NonNullList; // Scissors -+import net.minecraft.nbt.CompoundTag; // Scissors -+import net.minecraft.network.chat.Component; // Scissors -+import net.minecraft.network.chat.SignedMessageBody; // Scissors ++import java.util.Collections; ++ ++import net.minecraft.ChatFormatting; ++import net.minecraft.core.NonNullList; ++import net.minecraft.nbt.CompoundTag; ++import net.minecraft.network.chat.Component; ++import net.minecraft.network.chat.SignedMessageBody; import net.minecraft.network.protocol.Packet; -+import net.minecraft.network.protocol.game.*; // Scissors ++import net.minecraft.network.protocol.game.*; import net.minecraft.util.profiling.jfr.JvmProfiler; -+import net.minecraft.world.item.ItemStack; // Scissors ++import net.minecraft.world.item.ItemStack; import org.slf4j.Logger; public class PacketEncoder extends MessageToByteEncoder> { -@@ -19,6 +27,23 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -19,6 +28,23 @@ public class PacketEncoder extends MessageToByteEncoder> { this.codecKey = protocolKey; } @@ -49,9 +50,12 @@ index b5b228e67284baad3639b283595427a819bb1a44..617d7f41a57fb86620183b219f025bb8 protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception { Attribute> attribute = channelHandlerContext.channel().attr(this.codecKey); ConnectionProtocol.CodecData codecData = attribute.get(); -@@ -37,43 +62,58 @@ public class PacketEncoder extends MessageToByteEncoder> { - friendlyByteBuf.writeVarInt(i); - friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale +@@ -34,46 +60,58 @@ public class PacketEncoder extends MessageToByteEncoder> { + throw new IOException("Can't serialize unregistered packet"); + } else { + FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); +- friendlyByteBuf.writeVarInt(i); +- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale + // Scissors start + int k; @@ -59,7 +63,7 @@ index b5b228e67284baad3639b283595427a819bb1a44..617d7f41a57fb86620183b219f025bb8 - int j = friendlyByteBuf.writerIndex(); - packet.write(friendlyByteBuf); - int k = friendlyByteBuf.writerIndex() - j; -- if (false && k > 8388608) { // Paper - disable +- if (false && k > 8388608) { // Paper - Handle large packets disconnecting client; disable - throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); - } - @@ -80,7 +84,7 @@ index b5b228e67284baad3639b283595427a819bb1a44..617d7f41a57fb86620183b219f025bb8 - - throw var13; - } finally { -- // Paper start +- // Paper start - Handle large packets disconnecting client - int packetLength = friendlyByteBuf.readableBytes(); - if (packetLength > MAX_PACKET_SIZE) { - throw new PacketTooLargeException(packet, this.codecKey, packetLength); @@ -88,12 +92,12 @@ index b5b228e67284baad3639b283595427a819bb1a44..617d7f41a57fb86620183b219f025bb8 + if (packet == null) { + throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet)); } -- // Paper end +- // Paper end - Handle large packets disconnecting client - ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + friendlyByteBuf.clear(); + k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); } - +- + JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); + ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + // Scissors end @@ -150,12 +154,12 @@ index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f30 this.type = blockEntityType; this.tag = nbt.isEmpty() ? null : nbt; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 51e24105facfe71ce9f2757c6c881a21b58dacfd..5692fbae221fb01d32d92edc7bea0f6312e24e1c 100644 +index 998deae645b4497c3285bfba3260c636439f9ecf..f419d4330ea55c1ed91c539a7884ee6814a16ca3 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData { } - // Paper end + // Paper end - Handle oversized block entities in chunks + // Scissors start + public void clearNBT() { @@ -168,10 +172,10 @@ index 51e24105facfe71ce9f2757c6c881a21b58dacfd..5692fbae221fb01d32d92edc7bea0f63 @Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); } public ClientboundLevelChunkPacketData(LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo) { @@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData { - int totalTileEntities = 0; // Paper + int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks for(Map.Entry entry2 : chunk.getBlockEntities().entrySet()) { + if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size - // Paper start + // Paper start - Handle oversized block entities in chunks if (++totalTileEntities > TE_LIMIT) { var packet = entry2.getValue().getUpdatePacket(); diff --git a/patches/server/0014-Prevent-attributes-with-invalid-namespaces-from-bein.patch b/patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch similarity index 100% rename from patches/server/0014-Prevent-attributes-with-invalid-namespaces-from-bein.patch rename to patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch diff --git a/patches/server/0015-Don-t-query-player-data-in-the-nbt-component.patch b/patches/server/0016-Don-t-query-player-data-in-the-nbt-component.patch similarity index 100% rename from patches/server/0015-Don-t-query-player-data-in-the-nbt-component.patch rename to patches/server/0016-Don-t-query-player-data-in-the-nbt-component.patch diff --git a/patches/server/0016-Limit-string-tag-visitors-to-1024-elements.patch b/patches/server/0017-Limit-string-tag-visitors-to-1024-elements.patch similarity index 100% rename from patches/server/0016-Limit-string-tag-visitors-to-1024-elements.patch rename to patches/server/0017-Limit-string-tag-visitors-to-1024-elements.patch diff --git a/patches/server/0017-Fixes-creative-killing-potion-effects-and-certain-po.patch b/patches/server/0018-Fixes-creative-killing-potion-effects-and-certain-po.patch similarity index 100% rename from patches/server/0017-Fixes-creative-killing-potion-effects-and-certain-po.patch rename to patches/server/0018-Fixes-creative-killing-potion-effects-and-certain-po.patch diff --git a/patches/server/0018-Fix-negative-death-times.patch b/patches/server/0019-Fix-negative-death-times.patch similarity index 100% rename from patches/server/0018-Fix-negative-death-times.patch rename to patches/server/0019-Fix-negative-death-times.patch diff --git a/patches/server/0019-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0020-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch similarity index 100% rename from patches/server/0019-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch rename to patches/server/0020-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch diff --git a/patches/server/0020-Add-custom-classes-used-by-Scissors.patch b/patches/server/0021-Add-custom-classes-used-by-Scissors.patch similarity index 100% rename from patches/server/0020-Add-custom-classes-used-by-Scissors.patch rename to patches/server/0021-Add-custom-classes-used-by-Scissors.patch diff --git a/patches/server/0021-Reset-large-tags.patch b/patches/server/0022-Reset-large-tags.patch similarity index 100% rename from patches/server/0021-Reset-large-tags.patch rename to patches/server/0022-Reset-large-tags.patch diff --git a/patches/server/0022-Don-t-log-invalid-teams-to-console.patch b/patches/server/0023-Don-t-log-invalid-teams-to-console.patch similarity index 100% rename from patches/server/0022-Don-t-log-invalid-teams-to-console.patch rename to patches/server/0023-Don-t-log-invalid-teams-to-console.patch diff --git a/patches/server/0023-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch b/patches/server/0024-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch similarity index 100% rename from patches/server/0023-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch rename to patches/server/0024-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch diff --git a/patches/server/0024-Add-MasterBlockFireEvent.patch b/patches/server/0025-Add-MasterBlockFireEvent.patch similarity index 100% rename from patches/server/0024-Add-MasterBlockFireEvent.patch rename to patches/server/0025-Add-MasterBlockFireEvent.patch diff --git a/patches/server/0025-Add-spectator-teleport-event.patch b/patches/server/0026-Add-spectator-teleport-event.patch similarity index 100% rename from patches/server/0025-Add-spectator-teleport-event.patch rename to patches/server/0026-Add-spectator-teleport-event.patch diff --git a/patches/server/0026-Prevent-invalid-container-events.patch b/patches/server/0027-Prevent-invalid-container-events.patch similarity index 100% rename from patches/server/0026-Prevent-invalid-container-events.patch rename to patches/server/0027-Prevent-invalid-container-events.patch diff --git a/patches/server/0027-Disable-running-commands-in-books-by-default.patch b/patches/server/0028-Disable-running-commands-in-books-by-default.patch similarity index 100% rename from patches/server/0027-Disable-running-commands-in-books-by-default.patch rename to patches/server/0028-Disable-running-commands-in-books-by-default.patch diff --git a/patches/server/0028-Validate-block-entity-entity-tag-query-positions.patch b/patches/server/0029-Validate-block-entity-entity-tag-query-positions.patch similarity index 100% rename from patches/server/0028-Validate-block-entity-entity-tag-query-positions.patch rename to patches/server/0029-Validate-block-entity-entity-tag-query-positions.patch diff --git a/patches/server/0029-Refuse-to-convert-legacy-messages-over-1k-characters.patch b/patches/server/0030-Refuse-to-convert-legacy-messages-over-1k-characters.patch similarity index 100% rename from patches/server/0029-Refuse-to-convert-legacy-messages-over-1k-characters.patch rename to patches/server/0030-Refuse-to-convert-legacy-messages-over-1k-characters.patch diff --git a/patches/server/0030-Fix-ClickEvents-on-Signs-bypassing-permissions.patch b/patches/server/0031-Fix-ClickEvents-on-Signs-bypassing-permissions.patch similarity index 100% rename from patches/server/0030-Fix-ClickEvents-on-Signs-bypassing-permissions.patch rename to patches/server/0031-Fix-ClickEvents-on-Signs-bypassing-permissions.patch diff --git a/patches/server/0031-Prevent-velocity-freeze.patch b/patches/server/0032-Prevent-velocity-freeze.patch similarity index 100% rename from patches/server/0031-Prevent-velocity-freeze.patch rename to patches/server/0032-Prevent-velocity-freeze.patch diff --git a/patches/server/0032-Add-configuration-option-to-disable-chat-signatures.patch b/patches/server/0033-Add-configuration-option-to-disable-chat-signatures.patch similarity index 100% rename from patches/server/0032-Add-configuration-option-to-disable-chat-signatures.patch rename to patches/server/0033-Add-configuration-option-to-disable-chat-signatures.patch diff --git a/patches/server/0033-Patch-large-selector-distance-crash.patch b/patches/server/0034-Patch-large-selector-distance-crash.patch similarity index 100% rename from patches/server/0033-Patch-large-selector-distance-crash.patch rename to patches/server/0034-Patch-large-selector-distance-crash.patch diff --git a/patches/server/0034-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0035-Patch-invalid-entity-rotation-log-spam.patch similarity index 89% rename from patches/server/0034-Patch-invalid-entity-rotation-log-spam.patch rename to patches/server/0035-Patch-invalid-entity-rotation-log-spam.patch index fc9e1e8..a49f11c 100644 --- a/patches/server/0034-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0035-Patch-invalid-entity-rotation-log-spam.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Patch invalid entity rotation log spam diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ec0e041ee2ce4d763859a53221fb75a8da6dc283..760c3cdccb4361538bc0c4269ec4a7c9d6fa2db0 100644 +index fc6cff4121db4c08452817df846286103fe23ad9..3594e87329b99a2741749df04ac577a8fbe1a2fa 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4732,7 +4732,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0035-Limit-sculk-catalyst-cursor-positions.patch b/patches/server/0036-Limit-sculk-catalyst-cursor-positions.patch similarity index 100% rename from patches/server/0035-Limit-sculk-catalyst-cursor-positions.patch rename to patches/server/0036-Limit-sculk-catalyst-cursor-positions.patch diff --git a/patches/server/0036-Limit-map-decorations.patch b/patches/server/0037-Limit-map-decorations.patch similarity index 100% rename from patches/server/0036-Limit-map-decorations.patch rename to patches/server/0037-Limit-map-decorations.patch diff --git a/patches/server/0037-Prevent-player-banning-using-duplicate-UUIDs.patch b/patches/server/0038-Prevent-player-banning-using-duplicate-UUIDs.patch similarity index 100% rename from patches/server/0037-Prevent-player-banning-using-duplicate-UUIDs.patch rename to patches/server/0038-Prevent-player-banning-using-duplicate-UUIDs.patch diff --git a/patches/server/0038-Don-t-warn-on-duplicate-entity-UUIDs.patch b/patches/server/0039-Don-t-warn-on-duplicate-entity-UUIDs.patch similarity index 100% rename from patches/server/0038-Don-t-warn-on-duplicate-entity-UUIDs.patch rename to patches/server/0039-Don-t-warn-on-duplicate-entity-UUIDs.patch diff --git a/patches/server/0039-Implement-command-block-events.patch b/patches/server/0040-Implement-command-block-events.patch similarity index 100% rename from patches/server/0039-Implement-command-block-events.patch rename to patches/server/0040-Implement-command-block-events.patch diff --git a/patches/server/0040-Add-depth-limit-to-SNBT.patch b/patches/server/0041-Add-depth-limit-to-SNBT.patch similarity index 100% rename from patches/server/0040-Add-depth-limit-to-SNBT.patch rename to patches/server/0041-Add-depth-limit-to-SNBT.patch diff --git a/patches/server/0041-Limit-beacon-effectRange.patch b/patches/server/0042-Limit-beacon-effectRange.patch similarity index 100% rename from patches/server/0041-Limit-beacon-effectRange.patch rename to patches/server/0042-Limit-beacon-effectRange.patch diff --git a/patches/server/0042-Improve-validation-of-ResourceLocations.patch b/patches/server/0043-Improve-validation-of-ResourceLocations.patch similarity index 100% rename from patches/server/0042-Improve-validation-of-ResourceLocations.patch rename to patches/server/0043-Improve-validation-of-ResourceLocations.patch diff --git a/patches/server/0043-Don-t-log-on-too-many-chained-updates.patch b/patches/server/0044-Don-t-log-on-too-many-chained-updates.patch similarity index 100% rename from patches/server/0043-Don-t-log-on-too-many-chained-updates.patch rename to patches/server/0044-Don-t-log-on-too-many-chained-updates.patch diff --git a/patches/server/0044-Fix-packet-related-lag-exploits.patch b/patches/server/0045-Fix-packet-related-lag-exploits.patch similarity index 100% rename from patches/server/0044-Fix-packet-related-lag-exploits.patch rename to patches/server/0045-Fix-packet-related-lag-exploits.patch diff --git a/patches/server/0045-Limit-save-data-for-Bees-and-Vexes.patch b/patches/server/0046-Limit-save-data-for-Bees-and-Vexes.patch similarity index 100% rename from patches/server/0045-Limit-save-data-for-Bees-and-Vexes.patch rename to patches/server/0046-Limit-save-data-for-Bees-and-Vexes.patch diff --git a/patches/server/0046-Mute-invalid-attributes.patch b/patches/server/0047-Mute-invalid-attributes.patch similarity index 100% rename from patches/server/0046-Mute-invalid-attributes.patch rename to patches/server/0047-Mute-invalid-attributes.patch diff --git a/patches/server/0047-Mute-invalid-Enderdragon-phases.patch b/patches/server/0048-Mute-invalid-Enderdragon-phases.patch similarity index 100% rename from patches/server/0047-Mute-invalid-Enderdragon-phases.patch rename to patches/server/0048-Mute-invalid-Enderdragon-phases.patch diff --git a/patches/server/0048-Add-length-limit-to-note-block-sound.patch b/patches/server/0049-Add-length-limit-to-note-block-sound.patch similarity index 100% rename from patches/server/0048-Add-length-limit-to-note-block-sound.patch rename to patches/server/0049-Add-length-limit-to-note-block-sound.patch diff --git a/patches/server/0049-Change-version-fetcher-to-AMG.patch b/patches/server/0050-Change-version-fetcher-to-AMG.patch similarity index 100% rename from patches/server/0049-Change-version-fetcher-to-AMG.patch rename to patches/server/0050-Change-version-fetcher-to-AMG.patch