From 22ad9eedecfd7a07e211ead6d6327307d48ea0c4 Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Tue, 9 Aug 2022 23:51:17 -0400 Subject: [PATCH] Fix command pool submitting on shutdown (#8272) --- patches/server/0296-Async-command-map-building.patch | 9 +++++---- patches/server/0297-Implement-Brigadier-Mojang-API.patch | 8 ++++---- ...3-Fix-entity-type-tags-suggestions-in-selectors.patch | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/patches/server/0296-Async-command-map-building.patch b/patches/server/0296-Async-command-map-building.patch index 0e42b06c0..8a809e430 100644 --- a/patches/server/0296-Async-command-map-building.patch +++ b/patches/server/0296-Async-command-map-building.patch @@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues due to the shutdown logic generally being much later. diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 2bf67468a6c745bc6243c65210477ba129bfcb07..91b32a4856a4c9d6dc12871ed080f7a67311ead0 100644 +index 2bf67468a6c745bc6243c65210477ba129bfcb07..c4315531f93f4ed68b4621157b02572886e1ed30 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -360,6 +360,23 @@ public class Commands { +@@ -360,6 +360,24 @@ public class Commands { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -28,7 +28,8 @@ index 2bf67468a6c745bc6243c65210477ba129bfcb07..91b32a4856a4c9d6dc12871ed080f7a6 + new com.google.common.util.concurrent.ThreadFactoryBuilder() + .setNameFormat("Paper Async Command Builder Thread Pool - %1$d") + .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)) -+ .build() ++ .build(), ++ new java.util.concurrent.ThreadPoolExecutor.DiscardPolicy() + ); + + private void sendAsync(ServerPlayer player) { @@ -36,7 +37,7 @@ index 2bf67468a6c745bc6243c65210477ba129bfcb07..91b32a4856a4c9d6dc12871ed080f7a6 Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -377,7 +394,14 @@ public class Commands { +@@ -377,7 +395,14 @@ public class Commands { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } diff --git a/patches/server/0297-Implement-Brigadier-Mojang-API.patch b/patches/server/0297-Implement-Brigadier-Mojang-API.patch index dd76e70f9..34d738a5e 100644 --- a/patches/server/0297-Implement-Brigadier-Mojang-API.patch +++ b/patches/server/0297-Implement-Brigadier-Mojang-API.patch @@ -74,10 +74,10 @@ index 3308d684fc6cd0a83e190a52693b29d30e0087cb..aadddbc16aa719677c3b6fc4969b6145 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 91b32a4856a4c9d6dc12871ed080f7a67311ead0..0efb172c31a211e03d5fd922f65b6feff1317381 100644 +index c4315531f93f4ed68b4621157b02572886e1ed30..b141d251eedd31bd115342b878afd68dc51a8518 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -395,6 +395,7 @@ public class Commands { +@@ -396,6 +396,7 @@ public class Commands { bukkit.add(node.getName()); } // Paper start - Async command map building @@ -85,7 +85,7 @@ index 91b32a4856a4c9d6dc12871ed080f7a67311ead0..0efb172c31a211e03d5fd922f65b6fef net.minecraft.server.MinecraftServer.getServer().execute(() -> { runSync(player, bukkit, rootcommandnode); }); -@@ -402,6 +403,7 @@ public class Commands { +@@ -403,6 +404,7 @@ public class Commands { private void runSync(ServerPlayer player, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -93,7 +93,7 @@ index 91b32a4856a4c9d6dc12871ed080f7a67311ead0..0efb172c31a211e03d5fd922f65b6fef PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -@@ -420,6 +422,11 @@ public class Commands { +@@ -421,6 +423,11 @@ public class Commands { while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); diff --git a/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch index 9f869771c..ca29c1bbf 100644 --- a/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0813-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -35,10 +35,10 @@ index 6fdbe747645eb83f31b56bca77a9d7962237aed8..dd0143f319d4adef8834c513af34b1cc + // Paper end } diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 6d480d0332ee9348eacc3269890ee49206623c2a..584d2539d715fef26a2d01f014c7c3f4f8ce8fd9 100644 +index 27093aed1f4112a5414671fd5d9c4e683011506d..67ab16743b36dbf8b4336e33988d8e78433f566d 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -432,6 +432,7 @@ public class Commands { +@@ -433,6 +433,7 @@ public class Commands { private void fillUsableCommands(CommandNode tree, CommandNode result, CommandSourceStack source, Map, CommandNode> resultNodes) { Iterator iterator = tree.getChildren().iterator(); @@ -46,7 +46,7 @@ index 6d480d0332ee9348eacc3269890ee49206623c2a..584d2539d715fef26a2d01f014c7c3f4 while (iterator.hasNext()) { CommandNode commandnode2 = (CommandNode) iterator.next(); // Paper start -@@ -458,6 +459,12 @@ public class Commands { +@@ -459,6 +460,12 @@ public class Commands { if (requiredargumentbuilder.getSuggestionsProvider() != null) { requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));