2020-05-06 07:44:47 +00:00
|
|
|
From 9f7453549fbee5fae923580d3c02c0e4cf4cf57e Mon Sep 17 00:00:00 2001
|
2020-04-09 06:49:38 +00:00
|
|
|
From: Callahan <mr.callahhh@gmail.com>
|
|
|
|
Date: Wed, 8 Apr 2020 02:42:14 -0500
|
|
|
|
Subject: [PATCH] Async command map building
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java
|
2020-05-01 22:03:47 +00:00
|
|
|
index 37b1a7947c..2414b0a552 100644
|
2020-04-09 06:49:38 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/CommandDispatcher.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
|
|
|
|
@@ -241,6 +241,14 @@ public class CommandDispatcher {
|
|
|
|
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
|
|
|
|
// CraftBukkit start
|
|
|
|
// Register Vanilla commands into builtRoot as before
|
|
|
|
+ // Paper start - Async command map building
|
|
|
|
+ java.util.concurrent.ForkJoinPool.commonPool().execute(() -> {
|
|
|
|
+ sendAsync(entityplayer);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void sendAsync(EntityPlayer entityplayer) {
|
|
|
|
+ // Paper end - Async command map building
|
|
|
|
Map<CommandNode<CommandListenerWrapper>, CommandNode<ICompletionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
|
|
|
RootCommandNode vanillaRoot = new RootCommandNode();
|
|
|
|
|
|
|
|
@@ -258,7 +266,14 @@ public class CommandDispatcher {
|
|
|
|
for (CommandNode node : rootcommandnode.getChildren()) {
|
|
|
|
bukkit.add(node.getName());
|
|
|
|
}
|
|
|
|
+ // Paper start - Async command map building
|
|
|
|
+ MinecraftServer.getServer().execute(() -> {
|
|
|
|
+ runSync(entityplayer, bukkit, rootcommandnode);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private void runSync(EntityPlayer entityplayer, Collection<String> bukkit, RootCommandNode<ICompletionProvider> rootcommandnode) {
|
|
|
|
+ // Paper end - Async command map building
|
|
|
|
PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
|
|
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
--
|
2020-05-06 07:44:47 +00:00
|
|
|
2.26.0
|
2020-04-09 06:49:38 +00:00
|
|
|
|