Archiviert
13
0

Do not use ForkJoinPool common exector for creating client command struct (Fixes #6936)

Dieser Commit ist enthalten in:
Shane Freeder 2021-12-04 02:37:33 +00:00
Ursprung 2b97750f60
Commit 7323594d59
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
2 geänderte Dateien mit 8 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Async command map building
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index cc2337ee8a00fab8919a61324899113370bc5018..b28dc3f176221a6d6efb35af11b54777299b9242 100644
index cc2337ee8a00fab8919a61324899113370bc5018..ee31455158afbed8f3bbac57d2f41a59d01a0670 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -30,6 +30,7 @@ import net.minecraft.network.chat.MutableComponent;
@ -16,14 +16,12 @@ index cc2337ee8a00fab8919a61324899113370bc5018..b28dc3f176221a6d6efb35af11b54777
import net.minecraft.server.commands.AdvancementCommands;
import net.minecraft.server.commands.AttributeCommand;
import net.minecraft.server.commands.BanIpCommands;
@@ -344,6 +345,14 @@ public class Commands {
@@ -344,6 +345,12 @@ public class Commands {
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(player);
+ });
+ net.minecraft.server.MCUtil.scheduleAsyncTask(() -> this.sendAsync(player));
+ }
+
+ private void sendAsync(ServerPlayer player) {
@ -31,7 +29,7 @@ index cc2337ee8a00fab8919a61324899113370bc5018..b28dc3f176221a6d6efb35af11b54777
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode();
@@ -361,7 +370,14 @@ public class Commands {
@@ -361,7 +368,14 @@ public class Commands {
for (CommandNode node : rootcommandnode.getChildren()) {
bukkit.add(node.getName());
}

Datei anzeigen

@ -61,10 +61,10 @@ index 9f79c949d18c1ff3bdb49780fcecfc75366a8ff6..530a09fa3c9155459c6a4519e3412408
public boolean hasPermission(int level) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index b28dc3f176221a6d6efb35af11b54777299b9242..6624045921ef64046b375ec787cadda1e8c8435b 100644
index ee31455158afbed8f3bbac57d2f41a59d01a0670..4049576478efed97092b7e1b3d40afda6b114d68 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -371,6 +371,7 @@ public class Commands {
@@ -369,6 +369,7 @@ public class Commands {
bukkit.add(node.getName());
}
// Paper start - Async command map building
@ -72,7 +72,7 @@ index b28dc3f176221a6d6efb35af11b54777299b9242..6624045921ef64046b375ec787cadda1
MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode);
});
@@ -378,6 +379,7 @@ public class Commands {
@@ -376,6 +377,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building
@ -81,7 +81,7 @@ index b28dc3f176221a6d6efb35af11b54777299b9242..6624045921ef64046b375ec787cadda1
event.getPlayer().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2d2b1a293a1359ffa6d33635856406a909c452ce..be5f7b5e8537aa3bf4088fa8c2e9d6cce17c64ac 100644
index d4760d3cd2037ae47258d6016c6303e0a295dcbc..d0ed45db0226ebd8f60e9d84b7f41a3ca5cb3c9b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -747,8 +747,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser