mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 13:42:25 -07:00
Remove redundant fillUsableCommands call (#11425)
This commit is contained in:
@@ -2146,14 +2146,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
for (int i = 0; i < Math.min(astacktraceelement.length, 3); ++i) {
|
for (int i = 0; i < Math.min(astacktraceelement.length, 3); ++i) {
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -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
|
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.vanillaCommandDispatcher.getDispatcher().getRoot();
|
||||||
+ RootCommandNode<CommandSourceStack> vanilla = player.server.getCommands().getDispatcher().getRoot(); // Paper
|
- map.put(vanilla, vanillaRoot);
|
||||||
map.put(vanilla, vanillaRoot);
|
- this.fillUsableCommands(vanilla, vanillaRoot, player.createCommandSourceStack(), (Map) map);
|
||||||
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 {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user