diff --git a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch index 012bca23dd..57e83288d9 100644 --- a/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/api/Add-Raw-Byte-ItemStack-Serialization.patch @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private static final byte ARRAY_SERIALIZATION_VERSION = 1; + + /** -+ * Serializes a collection of items to raw bytes in NBT. Serializes empty items as null. ++ * Serializes a collection of items to raw bytes in NBT. Serializes null items as {@link #empty()}. + *

+ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. + * @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + /** -+ * Serializes a collection of items to raw bytes in NBT. Serializes empty items as null. ++ * Serializes a collection of items to raw bytes in NBT. Serializes null items as {@link #empty()}. + *

+ * If you need a string representation to put into a file, you can for example use {@link java.util.Base64} encoding. + * diff --git a/patches/api/Fix-upstream-javadocs.patch b/patches/api/Fix-upstream-javadocs.patch index 81acc243f9..74e963cea9 100644 --- a/patches/api/Fix-upstream-javadocs.patch +++ b/patches/api/Fix-upstream-javadocs.patch @@ -1050,6 +1050,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @NotNull @Override public AnvilView getView() { +diff --git a/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java b/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerCommandPreprocessEvent.java +@@ -0,0 +0,0 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell + * + * @param player New player which this event will execute as + * @throws IllegalArgumentException if the player provided is null ++ * @deprecated Only works for sign commands; use {@link Player#performCommand(String)}, including those cases + */ ++ @Deprecated(forRemoval = true) + public void setPlayer(@NotNull final Player player) throws IllegalArgumentException { + Preconditions.checkArgument(player != null, "Player cannot be null"); + this.player = player; +@@ -0,0 +0,0 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell + * unmodifiable set. + * + * @return All Players who will see this chat message +- * @deprecated This method is provided for backward compatibility with no +- * guarantee to the effect of viewing or modifying the set. ++ * @deprecated This is simply the online players. Modifications have no effect + */ + @NotNull +- @Deprecated ++ @Deprecated(forRemoval = true) + public Set getRecipients() { + return recipients; + } diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java diff --git a/patches/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch b/patches/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch new file mode 100644 index 0000000000..6ddee53cb4 --- /dev/null +++ b/patches/server/Fix-PlayerCommandPreprocessEvent-on-signed-commands.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 21 Sep 2024 22:01:52 +0200 +Subject: [PATCH] Fix PlayerCommandPreprocessEvent on signed commands + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server)); + this.cserver.getPluginManager().callEvent(event); +- +- if (event.isCancelled()) { +- return; +- } + command = event.getMessage().substring(1); + +- ParseResults parseresults = this.parseCommand(command); +- // CraftBukkit end +- +- Map map; ++ // Paper start - Fix cancellation and message changing ++ ParseResults parseresults = this.parseCommand(packet.command()); + ++ Map map; + try { +- map = (packet.command().equals(command)) ? this.collectSignedArguments(packet, SignableCommand.of(parseresults), lastSeenMessages) : Collections.emptyMap(); // CraftBukkit ++ // Always parse the original command to add to the chat chain ++ map = this.collectSignedArguments(packet, SignableCommand.of(parseresults), lastSeenMessages); + } catch (SignedMessageChain.DecodeException signedmessagechain_a) { + this.handleMessageDecodeFailure(signedmessagechain_a); + return; + } + ++ if (event.isCancelled()) { ++ // Only now are we actually good to return ++ return; ++ } ++ ++ // Remove signed parts if the command was changed ++ if (!command.equals(packet.command())) { ++ parseresults = this.parseCommand(command); ++ map = Collections.emptyMap(); ++ } ++ // Paper end - Fix cancellation and message changing ++ + CommandSigningContext.SignedArguments commandsigningcontext_a = new CommandSigningContext.SignedArguments(map); + + parseresults = Commands.mapSource(parseresults, (commandlistenerwrapper) -> { // CraftBukkit - decompile error