From 9e171ef8ff0a0ec57ebc75772fc9de578c987059 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 5 Feb 2024 12:31:51 +0100 Subject: [PATCH] Improve tag parser handling, move hunks out of chunk system patch --- .../server/0162-AsyncTabCompleteEvent.patch | 85 +++++------ .../0177-Player.setPlayerProfile-API.patch | 4 +- .../0209-InventoryCloseEvent-Reason-API.patch | 4 +- ...nventory-when-cancelling-PlayerInter.patch | 4 +- ...nd-make-tab-spam-limits-configurable.patch | 4 +- ...event-players-from-moving-into-unloa.patch | 6 +- ...t-allow-digging-into-unloaded-chunks.patch | 4 +- patches/server/0277-Book-Size-Limits.patch | 4 +- .../server/0284-Brigadier-Mojang-API.patch | 58 +++---- .../0286-Limit-Client-Sign-length-more.patch | 4 +- ...PickItem-Packet-and-kick-for-invalid.patch | 4 +- ...66-Prevent-teleporting-dead-entities.patch | 4 +- ...t-position-desync-causing-tp-exploit.patch | 4 +- .../0388-Add-PlayerRecipeBookClickEvent.patch | 4 +- ...90-Add-permission-for-command-blocks.patch | 6 +- ...ld-Difficulty-Remembering-Difficulty.patch | 4 +- ...o-not-accept-invalid-client-settings.patch | 4 +- ...ortation-and-cancel-velocity-if-tele.patch | 4 +- ...r-large-move-vectors-crashing-server.patch | 6 +- .../server/0466-Limit-recipe-packets.patch | 4 +- ...act-event-not-being-called-sometimes.patch | 6 +- ...-using-signs-inside-spawn-protection.patch | 4 +- ...ignore-result-of-PlayerEditBookEvent.patch | 4 +- ...fix-PlayerItemHeldEvent-firing-twice.patch | 4 +- ...pawnEvent-fix-passed-parameter-issue.patch | 4 +- ...560-Expand-PlayerGameModeChangeEvent.patch | 4 +- ...ove-range-check-for-block-placing-up.patch | 4 +- .../0566-Add-Unix-domain-socket-support.patch | 4 +- .../0572-Add-PlayerKickEvent-causes.patch | 42 ++--- ...nect-for-book-edit-is-called-on-main.patch | 4 +- .../server/0593-Add-PlayerArmSwingEvent.patch | 4 +- ...k-event-leave-message-not-being-sent.patch | 8 +- ...0633-Improve-and-expand-AsyncCatcher.patch | 4 +- ...-ServerboundCommandSuggestionPacket-.patch | 6 +- ...de-unnecessary-itemmeta-from-clients.patch | 4 +- ...nt-tile-entity-copies-loading-chunks.patch | 4 +- ...s-ServerLevel-for-gamerule-callbacks.patch | 4 +- ...g-not-using-commands.spam-exclusions.patch | 4 +- patches/server/0770-More-Teleport-API.patch | 4 +- ...ck-entities-after-destroy-prediction.patch | 4 +- .../0834-Improve-logging-and-errors.patch | 4 +- ...ssing-SpigotConfig-logCommands-check.patch | 4 +- ...le-player-info-update-packet-on-join.patch | 4 +- ...uence-violations-like-they-should-be.patch | 4 +- ...expired-keys-from-impacting-new-join.patch | 4 +- .../0903-Implement-PlayerFailMoveEvent.patch | 12 +- ...te-namespaced-commands-if-send-names.patch | 24 +-- .../server/0930-Add-PlayerPickItemEvent.patch | 4 +- ...ot-sanity-checks-in-container-clicks.patch | 4 +- .../server/0991-Rewrite-chunk-system.patch | 31 ---- ...on-checking-in-player-move-packet-ha.patch | 12 +- .../1032-Properly-resend-entities.patch | 6 +- .../1045-Improve-tag-parser-handling.patch | 143 ++++++++++++++++++ 53 files changed, 355 insertions(+), 248 deletions(-) create mode 100644 patches/server/1045-Improve-tag-parser-handling.patch diff --git a/patches/server/0162-AsyncTabCompleteEvent.patch b/patches/server/0162-AsyncTabCompleteEvent.patch index d6ddd62486..721226052f 100644 --- a/patches/server/0162-AsyncTabCompleteEvent.patch +++ b/patches/server/0162-AsyncTabCompleteEvent.patch @@ -16,10 +16,10 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ba2628f22907b386fe5638220e5f10e39bc1f80b..2d633b9921e04dac21d705ffdf0f5a92b41c2e30 100644 +index a30eb2a9e201face352be5c6f74e690d8e5c0478..0497393afd8f60ac17148dde2a394b4b6795c7d8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -688,27 +688,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -688,21 +688,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } @@ -33,61 +33,54 @@ index ba2628f22907b386fe5638220e5f10e39bc1f80b..2d633b9921e04dac21d705ffdf0f5a92 + // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { -- this.disconnect(Component.translatable("disconnect.spam")); -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent + this.disconnect(Component.translatable("disconnect.spam")); return; } // CraftBukkit end + // Paper start - AsyncTabCompleteEvent -+ TAB_COMPLETE_EXECUTOR.execute(() -> { ++ TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet)); ++ } ++ ++ private void handleCustomCommandSuggestions0(final ServerboundCommandSuggestionPacket packet) { StringReader stringreader = new StringReader(packet.getCommand()); if (stringreader.canRead() && stringreader.peek() == '/') { stringreader.skip(); } -- -- ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); -- -- this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); -+ final String command = packet.getCommand(); -+ final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null); -+ event.callEvent(); -+ final java.util.List completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.completions(); -+ // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server -+ if (!event.isHandled()) { -+ if (!event.isCancelled()) { -+ -+ this.server.scheduleOnMain(() -> { // This needs to be on main -+ ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); -+ -+ this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -+ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -+ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); -+ }); -+ }); -+ } -+ } else if (!completions.isEmpty()) { -+ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder0 = new com.mojang.brigadier.suggestion.SuggestionsBuilder(command, stringreader.getTotalLength()); -+ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1); -+ completions.forEach(completion -> { -+ final Integer intSuggestion = com.google.common.primitives.Ints.tryParse(completion.suggestion()); -+ if (intSuggestion != null) { -+ builder.suggest(intSuggestion, PaperAdventure.asVanilla(completion.tooltip())); -+ } else { -+ builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); -+ } -+ }); -+ player.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.buildFuture().join())); -+ } - }); -+ // Paper end - AsyncTabCompleteEvent - } - @Override ++ final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), packet.getCommand(), true, null); ++ event.callEvent(); ++ final List completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.completions(); ++ // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server ++ if (!event.isHandled()) { ++ if (event.isCancelled()) { ++ return; ++ } ++ ++ // This needs to be on main ++ this.server.scheduleOnMain(() -> this.sendServerSuggestions(packet, stringreader)); ++ } else if (!completions.isEmpty()) { ++ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder0 = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packet.getCommand(), stringreader.getTotalLength()); ++ final com.mojang.brigadier.suggestion.SuggestionsBuilder builder = builder0.createOffset(builder0.getInput().lastIndexOf(' ') + 1); ++ for (final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent.Completion completion : completions) { ++ final Integer intSuggestion = com.google.common.primitives.Ints.tryParse(completion.suggestion()); ++ if (intSuggestion != null) { ++ builder.suggest(intSuggestion, PaperAdventure.asVanilla(completion.tooltip())); ++ } else { ++ builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); ++ } ++ } ++ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.buildFuture().join())); ++ } ++ } ++ ++ private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) { ++ // Paper end - AsyncTabCompleteEvent + ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); + + this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 59776663cee396f29f05988d8e22dd5c23b118b5..fb26379f600cc3e7e286d246f25e2bf718611e9d 100644 +index 46acd80641b2ecafd9f364d7ad9b477b6b2f0289..22e61d492c935688b6d1d63d13ba8313abd9e1b4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2227,7 +2227,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/0177-Player.setPlayerProfile-API.patch b/patches/server/0177-Player.setPlayerProfile-API.patch index 8563d01997..6fa95377f9 100644 --- a/patches/server/0177-Player.setPlayerProfile-API.patch +++ b/patches/server/0177-Player.setPlayerProfile-API.patch @@ -9,10 +9,10 @@ This can be useful for changing name or skins after a player has logged in. public-f net.minecraft.world.entity.player.Player gameProfile diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 35c8c18fac425a60300718e80fd5304d2e41b53a..e37dc60167b8a6c3c321b5931ed90d13d4520236 100644 +index 0497393afd8f60ac17148dde2a394b4b6795c7d8..1da44846ad1ed2768fd7ebca4017c4bbc399ba68 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1461,7 +1461,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1467,7 +1467,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet()); } diff --git a/patches/server/0209-InventoryCloseEvent-Reason-API.patch b/patches/server/0209-InventoryCloseEvent-Reason-API.patch index 541deef783..e7a3e3b0ff 100644 --- a/patches/server/0209-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0209-InventoryCloseEvent-Reason-API.patch @@ -75,10 +75,10 @@ index d51244c634d0209efb98be965ce7318480220b96..33108a55c1cc305d44238d0862755af8 this.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e37dc60167b8a6c3c321b5931ed90d13d4520236..ddc9361f80bf28252852f9169b0f5d2f7a8320ba 100644 +index 1da44846ad1ed2768fd7ebca4017c4bbc399ba68..6bd81598a45fd0b428740f7be674adfe0c26aa05 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2520,10 +2520,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2526,10 +2526,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleContainerClose(ServerboundContainerClosePacket packet) { diff --git a/patches/server/0211-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/0211-Refresh-player-inventory-when-cancelling-PlayerInter.patch index 8aca1652ba..6a911ce332 100644 --- a/patches/server/0211-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/patches/server/0211-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ddc9361f80bf28252852f9169b0f5d2f7a8320ba..2e2bf7ba0a2511128cac1ff47b9a38a67b61522c 100644 +index 6bd81598a45fd0b428740f7be674adfe0c26aa05..60443fecfc6956e9863d8cf3cf74be447d48ba34 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2411,6 +2411,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2417,6 +2417,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (event.isCancelled()) { diff --git a/patches/server/0226-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0226-Break-up-and-make-tab-spam-limits-configurable.patch index e9536dc372..fffc05d609 100644 --- a/patches/server/0226-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0226-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2e2bf7ba0a2511128cac1ff47b9a38a67b61522c..14dc58263afbdafb576bd10f7b98403466093834 100644 +index 60443fecfc6956e9863d8cf3cf74be447d48ba34..4787d49964ddb93558faa271ad27f5bbc17742f2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -256,6 +256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -47,6 +47,6 @@ index 2e2bf7ba0a2511128cac1ff47b9a38a67b61522c..14dc58263afbdafb576bd10f7b984034 // CraftBukkit start - if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { + if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits - server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent + this.disconnect(Component.translatable("disconnect.spam")); return; } diff --git a/patches/server/0265-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0265-Add-option-to-prevent-players-from-moving-into-unloa.patch index 77c705521d..6edb55ba5a 100644 --- a/patches/server/0265-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0265-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 14dc58263afbdafb576bd10f7b98403466093834..5f68a0cd7e2484933dfa09cb54a0f2f18fa2241c 100644 +index 4787d49964ddb93558faa271ad27f5bbc17742f2..0c5ddfc6c12aaab10369ff96fcac1152965befcf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -474,9 +474,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -39,7 +39,7 @@ index 14dc58263afbdafb576bd10f7b98403466093834..5f68a0cd7e2484933dfa09cb54a0f2f1 if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); -@@ -1172,9 +1182,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1178,9 +1188,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } else { this.awaitingTeleportTime = this.tickCount; @@ -52,7 +52,7 @@ index 14dc58263afbdafb576bd10f7b98403466093834..5f68a0cd7e2484933dfa09cb54a0f2f1 float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot())); float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot())); -@@ -1230,6 +1240,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1236,6 +1246,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } else { speed = this.player.getAbilities().walkingSpeed * 10f; } diff --git a/patches/server/0272-Don-t-allow-digging-into-unloaded-chunks.patch b/patches/server/0272-Don-t-allow-digging-into-unloaded-chunks.patch index 82918f7cd2..48c08aa4bd 100644 --- a/patches/server/0272-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/patches/server/0272-Don-t-allow-digging-into-unloaded-chunks.patch @@ -59,10 +59,10 @@ index a8d33286832786031ac57e6ce27d5181e1a3d9b1..e8b12b27e5ec74afb940f575e5ce78e5 this.level.destroyBlockProgress(this.player.getId(), pos, -1); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5f68a0cd7e2484933dfa09cb54a0f2f18fa2241c..7c9e4673ef06c08f04691137cbef5ed3fc5d0b4b 100644 +index 0c5ddfc6c12aaab10369ff96fcac1152965befcf..7a63be0cfda49395c19d563bd298bf48888fd84c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1584,6 +1584,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1590,6 +1590,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: diff --git a/patches/server/0277-Book-Size-Limits.patch b/patches/server/0277-Book-Size-Limits.patch index f3ca6ba7dd..d43a591560 100644 --- a/patches/server/0277-Book-Size-Limits.patch +++ b/patches/server/0277-Book-Size-Limits.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits Puts some limits on the size of books. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7c9e4673ef06c08f04691137cbef5ed3fc5d0b4b..06120b7da7f830f4bb36e5c1ec71201e344a1182 100644 +index 7a63be0cfda49395c19d563bd298bf48888fd84c..2a49c02ad4baccc1fe3b0b69da0e584b7efec3ee 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1018,6 +1018,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1024,6 +1024,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleEditBook(ServerboundEditBookPacket packet) { diff --git a/patches/server/0284-Brigadier-Mojang-API.patch b/patches/server/0284-Brigadier-Mojang-API.patch index ad682edce3..3d9b5b23cc 100644 --- a/patches/server/0284-Brigadier-Mojang-API.patch +++ b/patches/server/0284-Brigadier-Mojang-API.patch @@ -131,39 +131,41 @@ index af7cb518a32a4d550eae833fdd5bb17fd4058717..40ff3090fb17fb0f01a9b52639fb783e if (commandnode2.canUse(source)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 06120b7da7f830f4bb36e5c1ec71201e344a1182..f68822bf363a1805678d8b19a0d6ffc0386337c8 100644 +index 2a49c02ad4baccc1fe3b0b69da0e584b7efec3ee..eb62f5f1a0dc0f7cd49d54af7f4899e94afc95ee 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -732,8 +732,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); - - this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); -+ // Paper start - Brigadier API -+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, command); -+ suggestEvent.setCancelled(suggestions.isEmpty()); -+ if (!suggestEvent.callEvent()) return; -+ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); -+ // Paper end - Brigadier API - }); - }); +@@ -746,7 +746,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); } -@@ -748,7 +752,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip())); - } - }); -- player.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.buildFuture().join())); -+ // Paper start - Brigadier API -+ com.mojang.brigadier.suggestion.Suggestions suggestions = builder.buildFuture().join(); -+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, command); -+ suggestEvent.setCancelled(suggestions.isEmpty()); -+ if (!suggestEvent.callEvent()) return; -+ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); -+ // Paper end - Brigadier API } +- this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), builder.buildFuture().join())); ++ // Paper start - Brigadier API ++ com.mojang.brigadier.suggestion.Suggestions suggestions = builder.buildFuture().join(); ++ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand()); ++ suggestEvent.setCancelled(suggestions.isEmpty()); ++ if (suggestEvent.callEvent()) { ++ this.connection.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); ++ } ++ // Paper end - Brigadier API + } + } + +@@ -755,8 +762,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); + + this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { +- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer +- this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestions)); ++ // Paper start - Brigadier API ++ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand()); ++ suggestEvent.setCancelled(suggestions.isEmpty()); ++ if (suggestEvent.callEvent()) { ++ this.send(new ClientboundCommandSuggestionsPacket(packet.getId(), suggestEvent.getSuggestions())); ++ } ++ // Paper end - Brigadier API }); - // Paper end - AsyncTabCompleteEvent + } + diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java index 83d81b9371902b0302d13e53b31c15fac4e67966..d113e54a30db16e2ad955170df6030d15de530d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java diff --git a/patches/server/0286-Limit-Client-Sign-length-more.patch b/patches/server/0286-Limit-Client-Sign-length-more.patch index dfe38f8df8..8132f66a3b 100644 --- a/patches/server/0286-Limit-Client-Sign-length-more.patch +++ b/patches/server/0286-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f68822bf363a1805678d8b19a0d6ffc0386337c8..3fd78a485bff00304e9eea69df376ae8c44be448 100644 +index eb62f5f1a0dc0f7cd49d54af7f4899e94afc95ee..79c7bce31d9c4e05afcb5cdbf06c4f6113d78ca3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -290,6 +290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -33,7 +33,7 @@ index f68822bf363a1805678d8b19a0d6ffc0386337c8..3fd78a485bff00304e9eea69df376ae8 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { super(server, connection, clientData, player); // CraftBukkit -@@ -3047,7 +3048,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3055,7 +3056,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSignUpdate(ServerboundSignUpdatePacket packet) { diff --git a/patches/server/0362-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0362-Validate-PickItem-Packet-and-kick-for-invalid.patch index 2746d101a5..9d54c62606 100644 --- a/patches/server/0362-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0362-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3fd78a485bff00304e9eea69df376ae8c44be448..a522c27a61384490aa938912316dfd76ab439cfd 100644 +index 79c7bce31d9c4e05afcb5cdbf06c4f6113d78ca3..36eb268d4aa4a8e7acb4498d27f2f7b75a519e2b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -859,7 +859,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -867,7 +867,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0366-Prevent-teleporting-dead-entities.patch b/patches/server/0366-Prevent-teleporting-dead-entities.patch index add5825315..67228f41f0 100644 --- a/patches/server/0366-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0366-Prevent-teleporting-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a522c27a61384490aa938912316dfd76ab439cfd..8700bfc853aa60cca55524bbba8f9343d4994faa 100644 +index 36eb268d4aa4a8e7acb4498d27f2f7b75a519e2b..2e239328e31318e873973f86422d7aa469ee61e1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1537,6 +1537,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1545,6 +1545,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { // Paper diff --git a/patches/server/0385-Prevent-position-desync-causing-tp-exploit.patch b/patches/server/0385-Prevent-position-desync-causing-tp-exploit.patch index fc83df049a..9ce0b93c5a 100644 --- a/patches/server/0385-Prevent-position-desync-causing-tp-exploit.patch +++ b/patches/server/0385-Prevent-position-desync-causing-tp-exploit.patch @@ -13,10 +13,10 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8700bfc853aa60cca55524bbba8f9343d4994faa..927fa8ee5e1b2d5822f80c586f474e6e115c3b15 100644 +index 2e239328e31318e873973f86422d7aa469ee61e1..41c7156c03da9660ce9d0bfb6e06350e200e8aed 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1358,6 +1358,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1366,6 +1366,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move diff --git a/patches/server/0388-Add-PlayerRecipeBookClickEvent.patch b/patches/server/0388-Add-PlayerRecipeBookClickEvent.patch index a421a70ff8..4862a88a63 100644 --- a/patches/server/0388-Add-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0388-Add-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 927fa8ee5e1b2d5822f80c586f474e6e115c3b15..cbb2b7665dbc2114a21000f274a0ce600420a31d 100644 +index 41c7156c03da9660ce9d0bfb6e06350e200e8aed..66727b650e31ceb587657e112a1b0e7be5d47608 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2954,16 +2954,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2962,16 +2962,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (!this.player.containerMenu.stillValid(this.player)) { ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); } else { diff --git a/patches/server/0390-Add-permission-for-command-blocks.patch b/patches/server/0390-Add-permission-for-command-blocks.patch index 4c75eb2298..134762ebfa 100644 --- a/patches/server/0390-Add-permission-for-command-blocks.patch +++ b/patches/server/0390-Add-permission-for-command-blocks.patch @@ -18,10 +18,10 @@ index e8b12b27e5ec74afb940f575e5ce78e5905d55f4..c3eb4b6372eed0b7eb636f495ce494b6 return false; } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cbb2b7665dbc2114a21000f274a0ce600420a31d..faf1add04576013b0d8743fe64688522d0c34ae9 100644 +index 66727b650e31ceb587657e112a1b0e7be5d47608..7ab30b8831b561374b7764148c4e5ed7451bafab 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -770,7 +770,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -778,7 +778,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); @@ -30,7 +30,7 @@ index cbb2b7665dbc2114a21000f274a0ce600420a31d..faf1add04576013b0d8743fe64688522 this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); } else { BaseCommandBlock commandblocklistenerabstract = null; -@@ -837,7 +837,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -845,7 +845,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (!this.server.isCommandBlockEnabled()) { this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); diff --git a/patches/server/0392-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0392-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index b206be4509..9482b89bc0 100644 --- a/patches/server/0392-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0392-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -89,10 +89,10 @@ index e3413273076b697d560c927ea0e12f34722a79c1..ab92c2c0ff5ebb395670c23fe0e3a812 playerlist.sendPlayerPermissionLevel(this); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index faf1add04576013b0d8743fe64688522d0c34ae9..f4230861d3d927726e7317ff1ebab4eac2dcff72 100644 +index 7ab30b8831b561374b7764148c4e5ed7451bafab..5487f04a6061d007c38bfad66e9b8251b5b0353b 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3157,7 +3157,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3165,7 +3165,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { diff --git a/patches/server/0399-Do-not-accept-invalid-client-settings.patch b/patches/server/0399-Do-not-accept-invalid-client-settings.patch index 08f8167e3d..340f0e9657 100644 --- a/patches/server/0399-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0399-Do-not-accept-invalid-client-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f4230861d3d927726e7317ff1ebab4eac2dcff72..6482886597e67a7e77b9087e283129da33a8bd8e 100644 +index 5487f04a6061d007c38bfad66e9b8251b5b0353b..540c33baacc57f5ec46b2f373d1cca2857463ecd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3149,6 +3149,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3157,6 +3157,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0430-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0430-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 2e80d7fc43..1481a759dc 100644 --- a/patches/server/0430-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0430-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,7 +9,7 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6482886597e67a7e77b9087e283129da33a8bd8e..231e8c5d719c73ecc1c2463e74661af07bf46df5 100644 +index 540c33baacc57f5ec46b2f373d1cca2857463ecd..e87ffaed1be9e849ea98bde8622a0a0a4645c435 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -656,7 +656,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -21,7 +21,7 @@ index 6482886597e67a7e77b9087e283129da33a8bd8e..231e8c5d719c73ecc1c2463e74661af0 this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodZ = this.awaitingPositionFromClient.z; -@@ -1579,7 +1579,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1587,7 +1587,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // CraftBukkit end this.awaitingTeleportTime = this.tickCount; diff --git a/patches/server/0440-Fix-for-large-move-vectors-crashing-server.patch b/patches/server/0440-Fix-for-large-move-vectors-crashing-server.patch index e8bdae3735..3335427256 100644 --- a/patches/server/0440-Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/0440-Fix-for-large-move-vectors-crashing-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 231e8c5d719c73ecc1c2463e74661af07bf46df5..d9811d50ee24a41991ad67a10805c3701b002824 100644 +index e87ffaed1be9e849ea98bde8622a0a0a4645c435..43e94e1dcf3e4c6c45cba2c7d75ac938938514b2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -472,9 +472,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -53,7 +53,7 @@ index 231e8c5d719c73ecc1c2463e74661af07bf46df5..d9811d50ee24a41991ad67a10805c370 boolean flag1 = entity.verticalCollisionBelow; if (entity instanceof LivingEntity) { -@@ -1264,7 +1273,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1272,7 +1281,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d7 = d1 - this.firstGoodY; double d8 = d2 - this.firstGoodZ; double d9 = this.player.getDeltaMovement().lengthSqr(); @@ -71,7 +71,7 @@ index 231e8c5d719c73ecc1c2463e74661af07bf46df5..d9811d50ee24a41991ad67a10805c370 if (this.player.isSleeping()) { if (d10 > 1.0D) { -@@ -1318,9 +1336,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1326,9 +1344,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl AABB axisalignedbb = this.player.getBoundingBox(); diff --git a/patches/server/0466-Limit-recipe-packets.patch b/patches/server/0466-Limit-recipe-packets.patch index 1970ef3081..09ebc50be5 100644 --- a/patches/server/0466-Limit-recipe-packets.patch +++ b/patches/server/0466-Limit-recipe-packets.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d9811d50ee24a41991ad67a10805c3701b002824..97525a4ee491f8954825ee3039da861ba6101d66 100644 +index 43e94e1dcf3e4c6c45cba2c7d75ac938938514b2..8b8a8d6d6473c14f9e0621bee82fb861de1d209f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -257,6 +257,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -24,7 +24,7 @@ index d9811d50ee24a41991ad67a10805c3701b002824..97525a4ee491f8954825ee3039da861b /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -2966,6 +2968,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2974,6 +2976,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0482-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0482-Fix-interact-event-not-being-called-sometimes.patch index cf77a4e9c0..f7f89fa24d 100644 --- a/patches/server/0482-Fix-interact-event-not-being-called-sometimes.patch +++ b/patches/server/0482-Fix-interact-event-not-being-called-sometimes.patch @@ -11,10 +11,10 @@ Subject: [PATCH] Fix interact event not being called sometimes Co-authored-by: Moulberry diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 97525a4ee491f8954825ee3039da861ba6101d66..6f8f1e3c5bb823fb992493b7e37cd352a84298fd 100644 +index 8b8a8d6d6473c14f9e0621bee82fb861de1d209f..d4b9f2b82527852c8fde8299801d54c9ba76371a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1752,7 +1752,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1760,7 +1760,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); this.player.sendSystemMessage(ichatmutablecomponent, true); @@ -23,7 +23,7 @@ index 97525a4ee491f8954825ee3039da861ba6101d66..6f8f1e3c5bb823fb992493b7e37cd352 this.player.swing(enumhand, true); } } -@@ -2298,13 +2298,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2306,13 +2306,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D; // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities diff --git a/patches/server/0527-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0527-Allow-using-signs-inside-spawn-protection.patch index 746a0c63ef..77ada4cbb9 100644 --- a/patches/server/0527-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0527-Allow-using-signs-inside-spawn-protection.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6f8f1e3c5bb823fb992493b7e37cd352a84298fd..03a343734b00e08611e670496e9c27bbea239153 100644 +index d4b9f2b82527852c8fde8299801d54c9ba76371a..c2e663082bbb956aabdcdb6372964f3e85541494 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1744,7 +1744,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1752,7 +1752,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl int i = this.player.level().getMaxBuildHeight(); if (blockposition.getY() < i) { diff --git a/patches/server/0533-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/0533-Don-t-ignore-result-of-PlayerEditBookEvent.patch index 62816160e7..96dde46b77 100644 --- a/patches/server/0533-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/0533-Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 03a343734b00e08611e670496e9c27bbea239153..10e45e3424a732049f91d4d71c98e210e2bef391 100644 +index c2e663082bbb956aabdcdb6372964f3e85541494..f0551a35583e05e3e0437eda6e78f9672d00648f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1179,7 +1179,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1187,7 +1187,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } itemstack.addTagElement("pages", nbttaglist); diff --git a/patches/server/0543-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0543-fix-PlayerItemHeldEvent-firing-twice.patch index 5df44d4874..0fbae7a4ae 100644 --- a/patches/server/0543-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0543-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 10e45e3424a732049f91d4d71c98e210e2bef391..194004b29f068991b70e6bde0c4da9f2c4738c1f 100644 +index f0551a35583e05e3e0437eda6e78f9672d00648f..c460baee67b23bd00dba149518d8afdb33743e3a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1913,6 +1913,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1921,6 +1921,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/server/0548-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch b/patches/server/0548-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch index ed8250066e..967badf8e0 100644 --- a/patches/server/0548-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch +++ b/patches/server/0548-Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 194004b29f068991b70e6bde0c4da9f2c4738c1f..87af53e0ce39a72f8bd861a9ff66b7e8ad8ef026 100644 +index c460baee67b23bd00dba149518d8afdb33743e3a..189b16f5c7bad3540671019136ed0ef8dfaacf74 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2620,7 +2620,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2628,7 +2628,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; diff --git a/patches/server/0560-Expand-PlayerGameModeChangeEvent.patch b/patches/server/0560-Expand-PlayerGameModeChangeEvent.patch index 7f1deb43a8..cfd1e1cd26 100644 --- a/patches/server/0560-Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/0560-Expand-PlayerGameModeChangeEvent.patch @@ -131,10 +131,10 @@ index a03d1a85019afdc42de2b8449fc38384c4dac51e..4fe571915b247ec612b2376dce57991e } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 87af53e0ce39a72f8bd861a9ff66b7e8ad8ef026..ce890d584cdb77bfb082ded375297fa7413da8ed 100644 +index 189b16f5c7bad3540671019136ed0ef8dfaacf74..813538573b24cc0fd30c6b67c138449809c36404 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2629,7 +2629,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2637,7 +2637,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { diff --git a/patches/server/0563-Move-range-check-for-block-placing-up.patch b/patches/server/0563-Move-range-check-for-block-placing-up.patch index df5b06d25e..a8136afa9f 100644 --- a/patches/server/0563-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0563-Move-range-check-for-block-placing-up.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ce890d584cdb77bfb082ded375297fa7413da8ed..41b232bea2b3b007deedf101e33f3575a04fa81a 100644 +index 813538573b24cc0fd30c6b67c138449809c36404..13e817da70328e4fc13327255afc88cfc848e5d2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1730,6 +1730,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1738,6 +1738,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (itemstack.isItemEnabled(worldserver.enabledFeatures())) { BlockHitResult movingobjectpositionblock = packet.getHitResult(); Vec3 vec3d = movingobjectpositionblock.getLocation(); diff --git a/patches/server/0566-Add-Unix-domain-socket-support.patch b/patches/server/0566-Add-Unix-domain-socket-support.patch index f67bbe74a7..7be6e655aa 100644 --- a/patches/server/0566-Add-Unix-domain-socket-support.patch +++ b/patches/server/0566-Add-Unix-domain-socket-support.patch @@ -87,10 +87,10 @@ index 25ddfe8e5da65e4ac70be2820ba139e7f3852c0c..87abd6274f9da9367094bad0c28acfa4 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 41b232bea2b3b007deedf101e33f3575a04fa81a..f3fcb18af47c04654aa004b5f1b94b9f48c6f78a 100644 +index 13e817da70328e4fc13327255afc88cfc848e5d2..4824c5f0f4c0e165e3622aac23e501f56e09fc73 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2463,6 +2463,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2471,6 +2471,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot Start public SocketAddress getRawAddress() { diff --git a/patches/server/0572-Add-PlayerKickEvent-causes.patch b/patches/server/0572-Add-PlayerKickEvent-causes.patch index b84e6abf45..b4470c2ecf 100644 --- a/patches/server/0572-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0572-Add-PlayerKickEvent-causes.patch @@ -209,7 +209,7 @@ index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef0 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fda5957dfc 100644 +index 4824c5f0f4c0e165e3622aac23e501f56e09fc73..1dcc0852bcaf44efaa9ff1e63560ddb9968a494a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -341,7 +341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -261,12 +261,12 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits -- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"))); // Paper - AsyncTabCompleteEvent -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - AsyncTabCompleteEvent & kick event cause +- this.disconnect(Component.translatable("disconnect.spam")); ++ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause return; } // CraftBukkit end -@@ -873,7 +873,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -881,7 +881,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -275,7 +275,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1058,7 +1058,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1066,7 +1066,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -284,7 +284,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } byteTotal += byteLength; -@@ -1081,14 +1081,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1089,14 +1089,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -301,7 +301,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1232,7 +1232,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1240,7 +1240,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { @@ -310,7 +310,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } else { ServerLevel worldserver = this.player.serverLevel(); -@@ -1652,7 +1652,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1660,7 +1660,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -319,7 +319,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } } -@@ -1935,7 +1935,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1943,7 +1943,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -328,7 +328,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } } -@@ -1948,7 +1948,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1956,7 +1956,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // CraftBukkit end if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { @@ -337,7 +337,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } else { Optional optional = this.tryHandleChat(packet.lastSeenMessages()); -@@ -1980,7 +1980,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1988,7 +1988,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChatCommand(ServerboundChatCommandPacket packet) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { @@ -346,7 +346,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } else { Optional optional = this.tryHandleChat(packet.lastSeenMessages()); -@@ -2036,7 +2036,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2044,7 +2044,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString()); if (exception.shouldDisconnect()) { @@ -355,7 +355,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } else { this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); } -@@ -2084,7 +2084,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2092,7 +2092,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (optional.isEmpty()) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -364,7 +364,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } return optional; -@@ -2270,7 +2270,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2278,7 +2278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // this.chatSpamTickCount += 20; if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // CraftBukkit end @@ -373,7 +373,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } } -@@ -2282,7 +2282,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2290,7 +2290,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl synchronized (this.lastSeenMessages) { if (!this.lastSeenMessages.applyOffset(packet.offset())) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -382,7 +382,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } } -@@ -2435,7 +2435,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2443,7 +2443,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (i > 4096) { @@ -391,7 +391,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } } -@@ -2492,7 +2492,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2500,7 +2500,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -400,7 +400,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } // Spigot End -@@ -2591,7 +2591,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2599,7 +2599,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // CraftBukkit end } } else { @@ -409,7 +409,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -2989,7 +2989,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2997,7 +2997,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -418,7 +418,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd return; } } -@@ -3231,7 +3231,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3239,7 +3239,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { @@ -427,7 +427,7 @@ index f3fcb18af47c04654aa004b5f1b94b9f48c6f78a..12c80c955333184254a23659b792b2fd } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -3244,7 +3244,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3252,7 +3252,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); diff --git a/patches/server/0589-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/0589-Ensure-disconnect-for-book-edit-is-called-on-main.patch index faaae2b796..8ed00ac7e8 100644 --- a/patches/server/0589-Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/0589-Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure disconnect for book edit is called on main diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 12c80c955333184254a23659b792b2fda5957dfc..95a3be18ccd2ba638d617d3e4d165f9c7a4062ed 100644 +index 1dcc0852bcaf44efaa9ff1e63560ddb9968a494a..a01af1e82d3a68da1016b440181c298c2f86fa06 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1088,7 +1088,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper end - Book size limits // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { diff --git a/patches/server/0593-Add-PlayerArmSwingEvent.patch b/patches/server/0593-Add-PlayerArmSwingEvent.patch index 378431a599..99a1f5af8a 100644 --- a/patches/server/0593-Add-PlayerArmSwingEvent.patch +++ b/patches/server/0593-Add-PlayerArmSwingEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 95a3be18ccd2ba638d617d3e4d165f9c7a4062ed..3285e26962f16cfc959a2cbedf961fb592100c33 100644 +index a01af1e82d3a68da1016b440181c298c2f86fa06..e56506562976b305568f15a554204919f6e34ad8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2320,7 +2320,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2328,7 +2328,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper end - Call interact event // Arm swing animation diff --git a/patches/server/0594-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0594-Fix-kick-event-leave-message-not-being-sent.patch index d436b2ebf3..a1233e3e59 100644 --- a/patches/server/0594-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0594-Fix-kick-event-leave-message-not-being-sent.patch @@ -50,10 +50,10 @@ index a65a1466dab52fca75cda16a4b22fef03b6207a0..0306771b8f90dcdd77f151c19c6c2d75 MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3285e26962f16cfc959a2cbedf961fb592100c33..a28141f7a4b59d98e1eb9fbd8c431fa3eedaf53e 100644 +index e56506562976b305568f15a554204919f6e34ad8..de4dc29d9cbdb739465f5df815b1e939a2bffee1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1874,6 +1874,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1882,6 +1882,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void onDisconnect(Component reason) { @@ -66,7 +66,7 @@ index 3285e26962f16cfc959a2cbedf961fb592100c33..a28141f7a4b59d98e1eb9fbd8c431fa3 // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -1882,11 +1888,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1890,11 +1896,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString()); @@ -86,7 +86,7 @@ index 3285e26962f16cfc959a2cbedf961fb592100c33..a28141f7a4b59d98e1eb9fbd8c431fa3 this.chatMessageChain.close(); // CraftBukkit start - Replace vanilla quit message handling with our own. /* -@@ -1896,7 +1908,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1904,7 +1916,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.disconnect(); // Paper start - Adventure diff --git a/patches/server/0633-Improve-and-expand-AsyncCatcher.patch b/patches/server/0633-Improve-and-expand-AsyncCatcher.patch index 88a2900331..7b49e7d545 100644 --- a/patches/server/0633-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0633-Improve-and-expand-AsyncCatcher.patch @@ -17,10 +17,10 @@ Async catch modifications to critical entity state Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5689d048b74e7608119f2e5db0022ba9b6180e5b..3a68fda44bbbfc706a53ea19312a040e38bfd8c3 100644 +index 935cb7d0529134115fdda73f1bcaf538b7dc7c94..4ab3f9321f37956420549e63ce65b955ca9c3b94 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1562,6 +1562,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1570,6 +1570,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { // Paper diff --git a/patches/server/0648-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0648-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch index 3bb4cef5ea..0a1bfe0a24 100644 --- a/patches/server/0648-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch +++ b/patches/server/0648-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3a68fda44bbbfc706a53ea19312a040e38bfd8c3..ed3efe348d345ceac3c5c6842c5b02ec95ab6b10 100644 +index 4ab3f9321f37956420549e63ce65b955ca9c3b94..fe83e4b592e13bf325e76d051df6901f22221484 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -725,6 +725,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -19,5 +19,5 @@ index 3a68fda44bbbfc706a53ea19312a040e38bfd8c3..ed3efe348d345ceac3c5c6842c5b02ec + } + // Paper end - Don't suggest if tab-complete is disabled // Paper start - AsyncTabCompleteEvent - TAB_COMPLETE_EXECUTOR.execute(() -> { - StringReader stringreader = new StringReader(packet.getCommand()); + TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet)); + } diff --git a/patches/server/0669-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0669-Hide-unnecessary-itemmeta-from-clients.patch index e4e67c937c..31a1c523e9 100644 --- a/patches/server/0669-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0669-Hide-unnecessary-itemmeta-from-clients.patch @@ -18,10 +18,10 @@ index 86f6e5bad325dd3d817b643388b196121624b8c7..062225ac8b5fbc44290352d78b215640 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ed3efe348d345ceac3c5c6842c5b02ec95ab6b10..737bf4600b1565684a78d973e785b881d7ddd4ea 100644 +index fe83e4b592e13bf325e76d051df6901f22221484..b07fbf0121c6f147ff6f59d13c2d976db9cedad1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2553,8 +2553,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2561,8 +2561,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Refresh the current entity metadata entity.getEntityData().refresh(ServerGamePacketListenerImpl.this.player); // SPIGOT-7136 - Allays diff --git a/patches/server/0736-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0736-Prevent-tile-entity-copies-loading-chunks.patch index 48aa355cbc..6df0fd17cc 100644 --- a/patches/server/0736-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0736-Prevent-tile-entity-copies-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 469b98f56124583fc9be37cfdac13edb89894814..7f4d844a2a20f4d33856078d2b0568fc432841ea 100644 +index 0017de198711446f82edecf6ac6afe064f315bd9..a62f10f672fb74b250de39ce3b8b3cd867d73869 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3099,7 +3099,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3107,7 +3107,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); if (this.player.level().isLoaded(blockposition)) { diff --git a/patches/server/0738-Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/0738-Pass-ServerLevel-for-gamerule-callbacks.patch index 1c66d54af2..546e668462 100644 --- a/patches/server/0738-Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/0738-Pass-ServerLevel-for-gamerule-callbacks.patch @@ -18,10 +18,10 @@ index c39b19bee3aca093a2087e19875a50ff21cf1ab3..8d7d5cadbd65833d46dce71609e93829 if (dedicatedserverproperties.enableQuery) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7f4d844a2a20f4d33856078d2b0568fc432841ea..fb38b0971ac45b3ae06a5b84abc960f1cac88c5e 100644 +index a62f10f672fb74b250de39ce3b8b3cd867d73869..e06d09ba19df5b7bf2b5179a07c39e2197cc0863 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2663,7 +2663,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2671,7 +2671,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent diff --git a/patches/server/0769-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch b/patches/server/0769-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch index 4233e9681c..ccaed9e8fa 100644 --- a/patches/server/0769-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch +++ b/patches/server/0769-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fb38b0971ac45b3ae06a5b84abc960f1cac88c5e..a801fff4d8339bf26689c28c8bd19f2d24b11836 100644 +index e06d09ba19df5b7bf2b5179a07c39e2197cc0863..141645f5ab844bd18d04e7d36beddcfa402dc8e9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2291,7 +2291,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2299,7 +2299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Spigot end // this.chatSpamTickCount += 20; diff --git a/patches/server/0770-More-Teleport-API.patch b/patches/server/0770-More-Teleport-API.patch index 543e52f53d..1641436dbf 100644 --- a/patches/server/0770-More-Teleport-API.patch +++ b/patches/server/0770-More-Teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a801fff4d8339bf26689c28c8bd19f2d24b11836..1b8c985b8014d11dbef9fde0ba900a14ad84d603 100644 +index 141645f5ab844bd18d04e7d36beddcfa402dc8e9..229c472bbd8c99086e0b63dbb4c1777e145d5130 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1550,11 +1550,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1558,11 +1558,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return false; // CraftBukkit - Return event status } diff --git a/patches/server/0773-Send-block-entities-after-destroy-prediction.patch b/patches/server/0773-Send-block-entities-after-destroy-prediction.patch index b513fa2bc0..a6b883a2d6 100644 --- a/patches/server/0773-Send-block-entities-after-destroy-prediction.patch +++ b/patches/server/0773-Send-block-entities-after-destroy-prediction.patch @@ -57,10 +57,10 @@ index 8f4c9b99b638cfce8cc7c55f6369f62e757f4e48..f3389dc345d8b6e5389ae37848d9b268 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1b8c985b8014d11dbef9fde0ba900a14ad84d603..418ece49cab9f4f2a7f65e8226a497658d0abd34 100644 +index 229c472bbd8c99086e0b63dbb4c1777e145d5130..17c059020eae2c125971b4f6ffe90db46fb85cd2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1696,8 +1696,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1704,8 +1704,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } // Paper end - Don't allow digging into unloaded chunks diff --git a/patches/server/0834-Improve-logging-and-errors.patch b/patches/server/0834-Improve-logging-and-errors.patch index cd1081f7c8..18002dd020 100644 --- a/patches/server/0834-Improve-logging-and-errors.patch +++ b/patches/server/0834-Improve-logging-and-errors.patch @@ -40,10 +40,10 @@ index 536f0c496ce36ca3248fc6eeac9bbd77214a36f9..31718823250a1490b783f426fff65bf5 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 418ece49cab9f4f2a7f65e8226a497658d0abd34..14ed8f39490ab1010974ba04b2202f73c2f83fb0 100644 +index 17c059020eae2c125971b4f6ffe90db46fb85cd2..6e1f1bd674e02426f42d013e2b0995d45e37ace0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3297,7 +3297,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3305,7 +3305,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { diff --git a/patches/server/0837-Add-missing-SpigotConfig-logCommands-check.patch b/patches/server/0837-Add-missing-SpigotConfig-logCommands-check.patch index 439601bb8f..ea5a11a633 100644 --- a/patches/server/0837-Add-missing-SpigotConfig-logCommands-check.patch +++ b/patches/server/0837-Add-missing-SpigotConfig-logCommands-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 14ed8f39490ab1010974ba04b2202f73c2f83fb0..8a2680112ccb04dff5cb49e87778b2a6c2d03518 100644 +index 6e1f1bd674e02426f42d013e2b0995d45e37ace0..853e4f393c2198d6bc263e546a9fa871f4996d05 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2052,7 +2052,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2060,7 +2060,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void performChatCommand(ServerboundChatCommandPacket packet, LastSeenMessages lastSeenMessages) { // CraftBukkit start String command = "/" + packet.command(); diff --git a/patches/server/0843-Use-single-player-info-update-packet-on-join.patch b/patches/server/0843-Use-single-player-info-update-packet-on-join.patch index f6387c1c40..72ccc71112 100644 --- a/patches/server/0843-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0843-Use-single-player-info-update-packet-on-join.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8a2680112ccb04dff5cb49e87778b2a6c2d03518..37a918777ee7128fc85c4ab33c1a630daf9f91fe 100644 +index 853e4f393c2198d6bc263e546a9fa871f4996d05..ada6ba862fee7dc474d57141947f18610f6c5974 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3327,7 +3327,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3335,7 +3335,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.chatMessageChain.append(() -> { this.player.setChatSession(session); diff --git a/patches/server/0862-Treat-sequence-violations-like-they-should-be.patch b/patches/server/0862-Treat-sequence-violations-like-they-should-be.patch index 0ad6f7a9d1..f48fe55b71 100644 --- a/patches/server/0862-Treat-sequence-violations-like-they-should-be.patch +++ b/patches/server/0862-Treat-sequence-violations-like-they-should-be.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Treat sequence violations like they should be diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 37a918777ee7128fc85c4ab33c1a630daf9f91fe..0dd9cbd0d0277334bf6feaa50ab6aeb573f02bad 100644 +index ada6ba862fee7dc474d57141947f18610f6c5974..10c17dacef22caa4616e0f93e4004ca4e63b9af0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1956,6 +1956,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1964,6 +1964,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void ackBlockChangesUpTo(int sequence) { if (sequence < 0) { diff --git a/patches/server/0864-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0864-Prevent-causing-expired-keys-from-impacting-new-join.patch index 3921e3812b..d1779637bf 100644 --- a/patches/server/0864-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0864-Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -24,7 +24,7 @@ index 0e54e8faa48751a651b953bec72543a94edf74bc..d43106eb89b14667e85cd6e8fa047d64 UPDATE_GAME_MODE((serialized, buf) -> { serialized.gameMode = GameType.byId(buf.readVarInt()); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0dd9cbd0d0277334bf6feaa50ab6aeb573f02bad..9440310f6a46fb62c4526f3cfb0464750fe72f84 100644 +index 10c17dacef22caa4616e0f93e4004ca4e63b9af0..0bc974ff4124ff6bfc355a6dac362574a649c476 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -286,6 +286,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -49,7 +49,7 @@ index 0dd9cbd0d0277334bf6feaa50ab6aeb573f02bad..9440310f6a46fb62c4526f3cfb046475 } public void resetPosition() { -@@ -3325,6 +3333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3333,6 +3341,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void resetPlayerChatState(RemoteChatSession session) { this.chatSession = session; diff --git a/patches/server/0903-Implement-PlayerFailMoveEvent.patch b/patches/server/0903-Implement-PlayerFailMoveEvent.patch index 850058536d..3f87c43562 100644 --- a/patches/server/0903-Implement-PlayerFailMoveEvent.patch +++ b/patches/server/0903-Implement-PlayerFailMoveEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerFailMoveEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9440310f6a46fb62c4526f3cfb0464750fe72f84..c4c9b3061aa79b8ab8e5b1f68780f4910a657b1d 100644 +index 0bc974ff4124ff6bfc355a6dac362574a649c476..e19c05504151885ca18496b50dcf6091d94078c0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1271,8 +1271,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1279,8 +1279,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; // Paper - OBFHELPER double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER @@ -19,7 +19,7 @@ index 9440310f6a46fb62c4526f3cfb0464750fe72f84..c4c9b3061aa79b8ab8e5b1f68780f491 if (this.player.isPassenger()) { this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); -@@ -1337,8 +1337,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1345,8 +1345,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper start - Prevent moving into unloaded chunks if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { @@ -36,7 +36,7 @@ index 9440310f6a46fb62c4526f3cfb0464750fe72f84..c4c9b3061aa79b8ab8e5b1f68780f491 } // Paper end - Prevent moving into unloaded chunks -@@ -1347,9 +1353,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1355,9 +1361,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end @@ -56,7 +56,7 @@ index 9440310f6a46fb62c4526f3cfb0464750fe72f84..c4c9b3061aa79b8ab8e5b1f68780f491 } } } -@@ -1411,14 +1424,29 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1419,14 +1432,29 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl d8 = d2 - this.player.getZ(); d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -89,7 +89,7 @@ index 9440310f6a46fb62c4526f3cfb0464750fe72f84..c4c9b3061aa79b8ab8e5b1f68780f491 this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround()); } else { -@@ -3351,4 +3379,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3359,4 +3387,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand); } diff --git a/patches/server/0919-Don-t-tab-complete-namespaced-commands-if-send-names.patch b/patches/server/0919-Don-t-tab-complete-namespaced-commands-if-send-names.patch index 1e9839c32d..be6481a9bd 100644 --- a/patches/server/0919-Don-t-tab-complete-namespaced-commands-if-send-names.patch +++ b/patches/server/0919-Don-t-tab-complete-namespaced-commands-if-send-names.patch @@ -11,18 +11,18 @@ This patch prevents server from sending namespaced commands when player requests tab-complete only commands. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c4c9b3061aa79b8ab8e5b1f68780f4910a657b1d..5cb6984475eb89ed2a822d7a9e485bed47d6431b 100644 +index e19c05504151885ca18496b50dcf6091d94078c0..10965bdd67dd1357d47f12cd96c204372aefd2d9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -762,6 +762,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); +@@ -792,6 +792,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); - this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -+ // Paper start - Don't tab-complete namespaced commands if send-namespaced is false -+ if (!org.spigotmc.SpigotConfig.sendNamespaced && suggestions.getRange().getStart() <= 1) { -+ suggestions.getList().removeIf(suggestion -> suggestion.getText().contains(":")); -+ } -+ // Paper end - Don't tab-complete namespaced commands if send-namespaced is false - // Paper start - Brigadier API - com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, command); - suggestEvent.setCancelled(suggestions.isEmpty()); + this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { ++ // Paper start - Don't tab-complete namespaced commands if send-namespaced is false ++ if (!org.spigotmc.SpigotConfig.sendNamespaced && suggestions.getRange().getStart() <= 1) { ++ suggestions.getList().removeIf(suggestion -> suggestion.getText().contains(":")); ++ } ++ // Paper end - Don't tab-complete namespaced commands if send-namespaced is false + // Paper start - Brigadier API + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, packet.getCommand()); + suggestEvent.setCancelled(suggestions.isEmpty()); diff --git a/patches/server/0930-Add-PlayerPickItemEvent.patch b/patches/server/0930-Add-PlayerPickItemEvent.patch index 34dd246e8f..64e15e8e6d 100644 --- a/patches/server/0930-Add-PlayerPickItemEvent.patch +++ b/patches/server/0930-Add-PlayerPickItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerPickItemEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5cb6984475eb89ed2a822d7a9e485bed47d6431b..74da8d5ba6ee6e7b897a0d28dac5d3d05faf3a88 100644 +index 10965bdd67dd1357d47f12cd96c204372aefd2d9..27c2eed2aed6e0a2868501e553a5fbfc0307bb0c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -899,8 +899,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -907,8 +907,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } diff --git a/patches/server/0940-Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/0940-Add-slot-sanity-checks-in-container-clicks.patch index 7f5440c576..3e7b7c8b9b 100644 --- a/patches/server/0940-Add-slot-sanity-checks-in-container-clicks.patch +++ b/patches/server/0940-Add-slot-sanity-checks-in-container-clicks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 74da8d5ba6ee6e7b897a0d28dac5d3d05faf3a88..c02249e271151b49cd581943ee8f890ca440e2c3 100644 +index 27c2eed2aed6e0a2868501e553a5fbfc0307bb0c..9e8b37f446a382204bc9ad61efed913f70a99b90 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2880,6 +2880,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2888,6 +2888,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl break; case SWAP: if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) { diff --git a/patches/server/0991-Rewrite-chunk-system.patch b/patches/server/0991-Rewrite-chunk-system.patch index 9d039ee646..20ba8999a5 100644 --- a/patches/server/0991-Rewrite-chunk-system.patch +++ b/patches/server/0991-Rewrite-chunk-system.patch @@ -15506,19 +15506,6 @@ index 0000000000000000000000000000000000000000..7e8dc9e8f381abfdcce2746edc93122d + } + } +} -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java -index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292bf595642 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java -@@ -14,7 +14,7 @@ public class ServerboundCommandSuggestionPacket implements Packet 64 && ((index = packet.getCommand().indexOf(' ')) == -1 || index >= 64)) { -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); -+ return; -+ } -+ // Paper end - rewrite chunk system - // Paper start - AsyncTabCompleteEvent - TAB_COMPLETE_EXECUTOR.execute(() -> { - StringReader stringreader = new StringReader(packet.getCommand()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 16ef96f0b2f68556b89c9d732d0e1a407f083fdc..d2e65c105c38c71a6b1739b95547772511a36345 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/patches/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch index 8dc44251a0..a795c6dc3b 100644 --- a/patches/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -8,7 +8,7 @@ Move collision logic to just the hasNewCollision call instead of getCubes + hasN CHECK ME diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9b55d284f 100644 +index 9e8b37f446a382204bc9ad61efed913f70a99b90..9a080c64f0478081a3ef5ae601978063ec3756da 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -552,7 +552,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -89,7 +89,7 @@ index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9 } @Override -@@ -1281,7 +1315,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1282,7 +1316,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (this.awaitingPositionFromClient != null) { @@ -98,7 +98,7 @@ index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9 this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } -@@ -1388,7 +1422,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1389,7 +1423,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -107,7 +107,7 @@ index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9 d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above -@@ -1430,6 +1464,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1431,6 +1465,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move @@ -115,7 +115,7 @@ index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9 // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { return; // ... thanks Mojang for letting move calls teleport across dimensions. -@@ -1458,7 +1493,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1459,7 +1494,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -134,7 +134,7 @@ index fa70d470327e307909cb17467f39f4596909f364..500cbbfe02cddfdcfb7f8d5ae9cf70c9 if (teleportBack) { io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.CLIPPED_INTO_BLOCK, toX, toY, toZ, toYaw, toPitch, false); -@@ -1558,6 +1603,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1559,6 +1604,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } diff --git a/patches/server/1032-Properly-resend-entities.patch b/patches/server/1032-Properly-resend-entities.patch index 2fada42f2c..f8a035f112 100644 --- a/patches/server/1032-Properly-resend-entities.patch +++ b/patches/server/1032-Properly-resend-entities.patch @@ -116,10 +116,10 @@ index 692a01b52a71e26887ee42cbd5fd64b0a81bfc99..ef3048a4748113538a0ee0af5b526b2c return enuminteractionresult; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 500cbbfe02cddfdcfb7f8d5ae9cf70c9b55d284f..2562ea3b63b055319a775c12ff327d127f8039c3 100644 +index 9a080c64f0478081a3ef5ae601978063ec3756da..9285346c99a15f133e985f217c4d8f75e8f2726f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1989,6 +1989,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1990,6 +1990,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (cancelled) { @@ -127,7 +127,7 @@ index 500cbbfe02cddfdcfb7f8d5ae9cf70c9b55d284f..2562ea3b63b055319a775c12ff327d12 this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } -@@ -2703,7 +2704,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2704,7 +2705,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { diff --git a/patches/server/1045-Improve-tag-parser-handling.patch b/patches/server/1045-Improve-tag-parser-handling.patch new file mode 100644 index 0000000000..cbb6f2ead2 --- /dev/null +++ b/patches/server/1045-Improve-tag-parser-handling.patch @@ -0,0 +1,143 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Mon, 5 Feb 2024 11:54:04 +0100 +Subject: [PATCH] Improve tag parser handling + + +diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java +index 92848b64a78fce7a92e1657c2da6fc5ee53eea44..5d0e8f4f3ad61a27452675277380e27d3d28d133 100644 +--- a/src/main/java/com/mojang/brigadier/CommandDispatcher.java ++++ b/src/main/java/com/mojang/brigadier/CommandDispatcher.java +@@ -307,6 +307,10 @@ public class CommandDispatcher { + try { + try { + child.parse(reader, context); ++ // Paper start - Handle non-reoverable exceptions; Rethrow NbtAccounterException so it can be caught properly and immediately ++ } catch (final net.minecraft.nbt.NbtAccounterException e) { ++ throw e; ++ // Paper end - Handle non-reoverable exceptions + } catch (final RuntimeException ex) { + throw CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherParseException().createWithContext(reader, ex.getMessage()); + } +diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java +index 5bec54239a2b185284c10d58854e5a13e33daae5..9ecd0b7ddaa8376f3c1448f810f7757c9ba1b90a 100644 +--- a/src/main/java/net/minecraft/nbt/TagParser.java ++++ b/src/main/java/net/minecraft/nbt/TagParser.java +@@ -48,6 +48,7 @@ public class TagParser { + } + }, CompoundTag::toString); + private final StringReader reader; ++ private int depth; // Paper + + public static CompoundTag parseTag(String string) throws CommandSyntaxException { + return (new TagParser(new StringReader(string))).readSingleStruct(); +@@ -156,6 +157,7 @@ public class TagParser { + + public CompoundTag readStruct() throws CommandSyntaxException { + this.expect('{'); ++ this.increaseDepth(); // Paper + CompoundTag compoundTag = new CompoundTag(); + this.reader.skipWhitespace(); + +@@ -179,6 +181,7 @@ public class TagParser { + } + + this.expect('}'); ++ this.depth--; // Paper + return compoundTag; + } + +@@ -188,6 +191,7 @@ public class TagParser { + if (!this.reader.canRead()) { + throw ERROR_EXPECTED_VALUE.createWithContext(this.reader); + } else { ++ this.increaseDepth(); // Paper + ListTag listTag = new ListTag(); + TagType tagType = null; + +@@ -213,6 +217,7 @@ public class TagParser { + } + + this.expect(']'); ++ this.depth--; // Paper + return listTag; + } + } +@@ -251,11 +256,11 @@ public class TagParser { + } + + if (typeReader == ByteTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsByte()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } else if (typeReader == LongTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsLong()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } else { +- list.add((T)((NumericTag)tag).getAsInt()); ++ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix + } + + if (this.hasElementSeparator()) { +@@ -286,4 +291,11 @@ public class TagParser { + this.reader.skipWhitespace(); + this.reader.expect(c); + } ++ ++ private void increaseDepth() { ++ this.depth++; ++ if (this.depth > 512) { ++ throw new net.minecraft.nbt.NbtAccounterException("NBT tag is too complex, depth > 512"); ++ } ++ } + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java +index a5e438a834826161c52ca9db57d234d9ff80a591..4766994cce060564370b0d24836a7da8b5e4a8a1 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java +@@ -14,7 +14,7 @@ public class ServerboundCommandSuggestionPacket implements Packet 64 && ((index = packet.getCommand().indexOf(' ')) == -1 || index >= 64)) { ++ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); ++ return; ++ } ++ // Paper end + // Paper start - AsyncTabCompleteEvent + TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet)); + } +@@ -823,7 +830,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + + private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) { + // Paper end - AsyncTabCompleteEvent +- ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); ++ // Paper start - Handle non-reoverable exceptions ++ ParseResults parseresults; ++ try { ++ parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); ++ } catch (final Throwable e) { // This is fine:tm: ++ if (LOGGER.isDebugEnabled()) { ++ LOGGER.error("Exception parsing command", e); ++ } ++ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); ++ return; ++ } ++ // Paper end - Handle non-reoverable exceptions + + this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { + // Paper start - Don't tab-complete namespaced commands if send-namespaced is false