summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-09-27 09:49:18 -0700
committerGitHub <[email protected]>2024-09-27 18:49:18 +0200
commitdd6d1842bb73d003544d519d10a01844e7275903 (patch)
tree5d6fb93f31e032407ffb73fa2177dd843221b14f
parent9c76642f9966380c6b16d96efbc2cebc5741fe95 (diff)
downloadPaper-dd6d1842bb73d003544d519d10a01844e7275903.tar.gz
Paper-dd6d1842bb73d003544d519d10a01844e7275903.zip
Remove redundant fillUsableCommands call (#11425)
-rw-r--r--patches/server/0965-Brigadier-based-command-API.patch24
-rw-r--r--patches/server/1006-Fix-entity-type-tags-suggestions-in-selectors.patch6
2 files changed, 18 insertions, 12 deletions
diff --git a/patches/server/0965-Brigadier-based-command-API.patch b/patches/server/0965-Brigadier-based-command-API.patch
index b9137c398a..d93978b6d2 100644
--- a/patches/server/0965-Brigadier-based-command-API.patch
+++ b/patches/server/0965-Brigadier-based-command-API.patch
@@ -2078,7 +2078,7 @@ index 3c0d2332207ba638faaaa4280bce18c334a01271..4017b82e72fefd6685e9250a936686fd
public org.bukkit.command.CommandSender getBukkitSender() {
return this.source.getBukkitSender(this);
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
-index 7b86e064564d3a285e3971fd08ea6168bac0720e..e8dcbe7c6d6ed20ad19d2ba1893ad16d917b9993 100644
+index 7b86e064564d3a285e3971fd08ea6168bac0720e..74fcdc74dc6c5cbf81abb7d46fc700473bd00eff 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -155,7 +155,7 @@ public class Commands {
@@ -2145,16 +2145,22 @@ index 7b86e064564d3a285e3971fd08ea6168bac0720e..e8dcbe7c6d6ed20ad19d2ba1893ad16d
StackTraceElement[] astacktraceelement = exception.getStackTrace();
for (int i = 0; i < Math.min(astacktraceelement.length, 3); ++i) {
-@@ -475,7 +494,7 @@ public class Commands {
+@@ -473,13 +492,7 @@ public class Commands {
+ private void sendAsync(ServerPlayer player) {
+ // Paper end - Perf: Async command map building
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
- RootCommandNode vanillaRoot = new RootCommandNode();
-
+- RootCommandNode vanillaRoot = new RootCommandNode();
+-
- RootCommandNode<CommandSourceStack> vanilla = player.server.vanillaCommandDispatcher.getDispatcher().getRoot();
-+ RootCommandNode<CommandSourceStack> vanilla = player.server.getCommands().getDispatcher().getRoot(); // Paper
- map.put(vanilla, vanillaRoot);
- this.fillUsableCommands(vanilla, vanillaRoot, player.createCommandSourceStack(), (Map) map);
+- map.put(vanilla, vanillaRoot);
+- this.fillUsableCommands(vanilla, vanillaRoot, player.createCommandSourceStack(), (Map) map);
+-
+- // Now build the global commands in a second pass
++ // Paper - brigadier API removes the need to fill the map twice
+ RootCommandNode<SharedSuggestionProvider> rootcommandnode = new RootCommandNode();
-@@ -513,6 +532,7 @@ public class Commands {
+ map.put(this.dispatcher.getRoot(), rootcommandnode);
+@@ -513,6 +526,7 @@ public class Commands {
}
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
@@ -2162,7 +2168,7 @@ index 7b86e064564d3a285e3971fd08ea6168bac0720e..e8dcbe7c6d6ed20ad19d2ba1893ad16d
Iterator iterator = tree.getChildren().iterator();
while (iterator.hasNext()) {
-@@ -526,6 +546,42 @@ public class Commands {
+@@ -526,6 +540,42 @@ public class Commands {
if (commandnode2.canUse(source)) {
ArgumentBuilder argumentbuilder = commandnode2.createBuilder(); // CraftBukkit - decompile error
diff --git a/patches/server/1006-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/1006-Fix-entity-type-tags-suggestions-in-selectors.patch
index 7892753fc2..b53d0185a7 100644
--- a/patches/server/1006-Fix-entity-type-tags-suggestions-in-selectors.patch
+++ b/patches/server/1006-Fix-entity-type-tags-suggestions-in-selectors.patch
@@ -35,10 +35,10 @@ index 4017b82e72fefd6685e9250a936686fd8a0891f1..2d344df35d47b4b1ecddf32ccaa4dae4
+ // Paper end - tell clients to ask server for suggestions for EntityArguments
}
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
-index e8dcbe7c6d6ed20ad19d2ba1893ad16d917b9993..3e454515360c22a26c9329e4032d525579110d7e 100644
+index 74fcdc74dc6c5cbf81abb7d46fc700473bd00eff..5ff234c4efdc5347e01ad7473751606198de62e8 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
-@@ -535,6 +535,7 @@ public class Commands {
+@@ -529,6 +529,7 @@ public class Commands {
resultNodes.keySet().removeIf((node) -> !org.spigotmc.SpigotConfig.sendNamespaced && node.getName().contains( ":" )); // Paper - Remove namedspaced from result nodes to prevent redirect trimming ~ see comment below
Iterator iterator = tree.getChildren().iterator();
@@ -46,7 +46,7 @@ index e8dcbe7c6d6ed20ad19d2ba1893ad16d917b9993..3e454515360c22a26c9329e4032d5255
while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
// Paper start - Brigadier API
-@@ -597,6 +598,12 @@ public class Commands {
+@@ -591,6 +592,12 @@ public class Commands {
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));