Copy dispatcher root children before passing it into async tree building
This commit is contained in:
parent
64828f3a60
commit
5ab678947f
4 changed files with 54 additions and 23 deletions
|
@ -2068,7 +2068,7 @@ index fc0c60b22844ed010aede2fa125b9fa440d3de80..3549ffea451b932602efb113844ba21a
|
|||
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 26bc8d7075f8a9c411776ab91aeddcd776d21348..2fc5651d1546fd4bb10b0617540e906f483cb36c 100644
|
||||
index f190a65ee2e091d4d5a1e114178eac42740075d4..622677fb281242681bf8ba39de34187bcc898a5f 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -159,7 +159,7 @@ public class Commands {
|
||||
|
@ -2135,8 +2135,8 @@ index 26bc8d7075f8a9c411776ab91aeddcd776d21348..2fc5651d1546fd4bb10b0617540e906f
|
|||
StackTraceElement[] astacktraceelement = exception.getStackTrace();
|
||||
|
||||
for (int i = 0; i < Math.min(astacktraceelement.length, 3); ++i) {
|
||||
@@ -473,13 +492,7 @@ public class Commands {
|
||||
private void sendAsync(ServerPlayer player) {
|
||||
@@ -475,13 +494,7 @@ public class Commands {
|
||||
private void sendAsync(ServerPlayer player, Collection<CommandNode<CommandSourceStack>> dispatcherRootChildren) {
|
||||
// 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();
|
||||
|
@ -2150,15 +2150,15 @@ index 26bc8d7075f8a9c411776ab91aeddcd776d21348..2fc5651d1546fd4bb10b0617540e906f
|
|||
RootCommandNode<SharedSuggestionProvider> rootcommandnode = new RootCommandNode();
|
||||
|
||||
map.put(this.dispatcher.getRoot(), rootcommandnode);
|
||||
@@ -513,6 +526,7 @@ public class Commands {
|
||||
}
|
||||
@@ -516,6 +529,7 @@ public class Commands {
|
||||
|
||||
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
|
||||
// Paper start - Perf: Async command map building; pass copy of children
|
||||
private void fillUsableCommands(Collection<CommandNode<CommandSourceStack>> children, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
|
||||
+ 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();
|
||||
Iterator iterator = children.iterator();
|
||||
// Paper end - Perf: Async command map building
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -526,6 +540,42 @@ public class Commands {
|
||||
@@ -530,6 +544,42 @@ public class Commands {
|
||||
|
||||
if (commandnode2.canUse(source)) {
|
||||
ArgumentBuilder argumentbuilder = commandnode2.createBuilder(); // CraftBukkit - decompile error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue