aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch
diff options
context:
space:
mode:
authorKyle Wood <[email protected]>2021-04-24 17:01:33 -0500
committerKyle Wood <[email protected]>2021-04-25 18:37:43 -0500
commit3093b81fee3064603c368ab934eddf66ce304433 (patch)
treecb99f05b5f31de92c41af4cc40b4bef5f3cbf573 /Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch
parent1af696a05d21cbdd7b5a7170f95598c013257588 (diff)
downloadPaper-3093b81fee3064603c368ab934eddf66ce304433.tar.gz
Paper-3093b81fee3064603c368ab934eddf66ce304433.zip
Move patches
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch')
-rw-r--r--Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch b/Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch
new file mode 100644
index 0000000000..463fac0fc7
--- /dev/null
+++ b/Spigot-Server-Patches-Unmapped/0437-Async-command-map-building.patch
@@ -0,0 +1,48 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Callahan <[email protected]>
+Date: Wed, 8 Apr 2020 02:42:14 -0500
+Subject: [PATCH] Async command map building
+
+
+diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java
+index ddbd4c43bbe6d6a5b90f4958c4be80520a40beab..c97424b401147be53ffa7e2a2a3271d696752efe 100644
+--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java
++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java
+@@ -29,6 +29,7 @@ import net.minecraft.network.chat.ChatHoverable;
+ import net.minecraft.network.chat.ChatMessage;
+ import net.minecraft.network.chat.IChatMutableComponent;
+ import net.minecraft.network.protocol.game.PacketPlayOutCommands;
++import net.minecraft.server.MinecraftServer;
+ import net.minecraft.server.commands.CommandAdvancement;
+ import net.minecraft.server.commands.CommandAttribute;
+ import net.minecraft.server.commands.CommandBan;
+@@ -327,6 +328,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();
+
+@@ -344,7 +353,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);
+