From 7323594d59206e41a39405e09fa5394c942fe5c6 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 4 Dec 2021 02:37:33 +0000 Subject: [PATCH] Do not use ForkJoinPool common exector for creating client command struct (Fixes #6936) --- patches/server/0305-Async-command-map-building.patch | 10 ++++------ .../server/0306-Implement-Brigadier-Mojang-API.patch | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/patches/server/0305-Async-command-map-building.patch b/patches/server/0305-Async-command-map-building.patch index bc26b8db64..7581f7fb8f 100644 --- a/patches/server/0305-Async-command-map-building.patch +++ b/patches/server/0305-Async-command-map-building.patch @@ -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> 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()); } diff --git a/patches/server/0306-Implement-Brigadier-Mojang-API.patch b/patches/server/0306-Implement-Brigadier-Mojang-API.patch index 7ceb9e5819..ae93d82a96 100644 --- a/patches/server/0306-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0306-Implement-Brigadier-Mojang-API.patch @@ -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 bukkit, RootCommandNode 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