diff options
author | Jason Penilla <[email protected]> | 2024-07-28 22:36:50 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-07-28 22:36:50 -0700 |
commit | 45ab4c38a5eed28565b63e081d2e8302e5510089 (patch) | |
tree | ed134b6a700178f70c85ba6754380fd7775d66b9 | |
parent | 68d2313bb05ce5d4abb0bc0080737f735d3e6bf0 (diff) | |
download | Paper-fix/jroy.tar.gz Paper-fix/jroy.zip |
make fix more targetedfix/jroy
mainly because it didn't work for vanilla commands :)
-rw-r--r-- | patches/server/0972-Brigadier-based-command-API.patch | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/patches/server/0972-Brigadier-based-command-API.patch b/patches/server/0972-Brigadier-based-command-API.patch index c50682758a..480e919abb 100644 --- a/patches/server/0972-Brigadier-based-command-API.patch +++ b/patches/server/0972-Brigadier-based-command-API.patch @@ -1504,7 +1504,7 @@ index 0000000000000000000000000000000000000000..c59bbd90fdf04db837366218b312e7fb +} diff --git a/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitBrigForwardingMap.java b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitBrigForwardingMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..46213c0d7ea777f829d6da6ea4ebe2620d5dce8c +index 0000000000000000000000000000000000000000..5eef7ae5197bd395fbd6800530ffe34d147651ff --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/bukkit/BukkitBrigForwardingMap.java @@ -0,0 +1,338 @@ @@ -1513,10 +1513,10 @@ index 0000000000000000000000000000000000000000..46213c0d7ea777f829d6da6ea4ebe262 +import com.google.common.collect.Iterators; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.tree.CommandNode; -+import com.mojang.brigadier.tree.LiteralCommandNode; +import io.papermc.paper.command.brigadier.CommandSourceStack; +import io.papermc.paper.command.brigadier.PaperBrigadier; +import io.papermc.paper.command.brigadier.PaperCommands; ++import io.papermc.paper.command.brigadier.PluginVanillaCommandWrapper; +import java.util.AbstractCollection; +import java.util.AbstractSet; +import java.util.ArrayList; @@ -1530,7 +1530,6 @@ index 0000000000000000000000000000000000000000..46213c0d7ea777f829d6da6ea4ebe262 +import java.util.function.Consumer; +import java.util.stream.Stream; +import org.bukkit.command.Command; -+import org.bukkit.craftbukkit.command.VanillaCommandWrapper; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + @@ -1607,7 +1606,8 @@ index 0000000000000000000000000000000000000000..46213c0d7ea777f829d6da6ea4ebe262 + public Command put(String key, Command value) { + Command old = this.get(key); + this.getDispatcher().getRoot().removeCommand(key); // Override previous command -+ if (value instanceof VanillaCommandWrapper wrapper) { ++ if (value instanceof PluginVanillaCommandWrapper wrapper && wrapper.getName().equals(key)) { ++ // Don't break when some plugin tries to remove and add back a plugin command registered with modern API... + this.getDispatcher().getRoot().addChild((CommandNode) wrapper.vanillaCommand); + } else { + this.getDispatcher().getRoot().addChild(BukkitCommandNode.of(key, value)); |