mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
e792da723a
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 30885166 Update to Minecraft 1.16.4 CraftBukkit Changes: 3af81c71 Update to Minecraft 1.16.4 Spigot Changes: f011ca24 Update to Minecraft 1.16.4 Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
41 lines
2.0 KiB
Diff
41 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 3a91513951f635b82d3d612c29e78f9f1db4860d..4b1ea9bc39191e01f83577c7bad128cf1ab9612f 100644
|
|
--- a/src/main/java/net/minecraft/server/CommandDispatcher.java
|
|
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
|
|
@@ -244,6 +244,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();
|
|
|
|
@@ -261,7 +269,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);
|
|
|