Remove redundant fillUsableCommands call (#11425)

This commit is contained in:
Jake Potrebic 2024-09-27 09:49:18 -07:00
parent ddd068d513
commit c40eeeefec

View file

@ -2146,14 +2146,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for (int i = 0; i < Math.min(astacktraceelement.length, 3); ++i) {
@@ -0,0 +0,0 @@ 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();
map.put(this.dispatcher.getRoot(), rootcommandnode);
@@ -0,0 +0,0 @@ public class Commands {
}