Fix command pool submitting on shutdown (#8272)
This commit is contained in:
parent
e6f8284125
commit
22ad9eedec
3 changed files with 12 additions and 11 deletions
|
@ -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.
|
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
|
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
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/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
|
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// Register Vanilla commands into builtRoot as before
|
// Register Vanilla commands into builtRoot as before
|
||||||
|
@ -28,7 +28,8 @@ index 2bf67468a6c745bc6243c65210477ba129bfcb07..91b32a4856a4c9d6dc12871ed080f7a6
|
||||||
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
|
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
|
||||||
+ .setNameFormat("Paper Async Command Builder Thread Pool - %1$d")
|
+ .setNameFormat("Paper Async Command Builder Thread Pool - %1$d")
|
||||||
+ .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER))
|
+ .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER))
|
||||||
+ .build()
|
+ .build(),
|
||||||
|
+ new java.util.concurrent.ThreadPoolExecutor.DiscardPolicy()
|
||||||
+ );
|
+ );
|
||||||
+
|
+
|
||||||
+ private void sendAsync(ServerPlayer player) {
|
+ private void sendAsync(ServerPlayer player) {
|
||||||
|
@ -36,7 +37,7 @@ index 2bf67468a6c745bc6243c65210477ba129bfcb07..91b32a4856a4c9d6dc12871ed080f7a6
|
||||||
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
||||||
RootCommandNode vanillaRoot = new RootCommandNode();
|
RootCommandNode vanillaRoot = new RootCommandNode();
|
||||||
|
|
||||||
@@ -377,7 +394,14 @@ public class Commands {
|
@@ -377,7 +395,14 @@ public class Commands {
|
||||||
for (CommandNode node : rootcommandnode.getChildren()) {
|
for (CommandNode node : rootcommandnode.getChildren()) {
|
||||||
bukkit.add(node.getName());
|
bukkit.add(node.getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,10 +74,10 @@ index 3308d684fc6cd0a83e190a52693b29d30e0087cb..aadddbc16aa719677c3b6fc4969b6145
|
||||||
public boolean hasPermission(int level) {
|
public boolean hasPermission(int level) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
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
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/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());
|
bukkit.add(node.getName());
|
||||||
}
|
}
|
||||||
// Paper start - Async command map building
|
// Paper start - Async command map building
|
||||||
|
@ -85,7 +85,7 @@ index 91b32a4856a4c9d6dc12871ed080f7a67311ead0..0efb172c31a211e03d5fd922f65b6fef
|
||||||
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
||||||
runSync(player, bukkit, rootcommandnode);
|
runSync(player, bukkit, rootcommandnode);
|
||||||
});
|
});
|
||||||
@@ -402,6 +403,7 @@ public class Commands {
|
@@ -403,6 +404,7 @@ public class Commands {
|
||||||
|
|
||||||
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
||||||
// Paper end - Async command map building
|
// Paper end - Async command map building
|
||||||
|
@ -93,7 +93,7 @@ index 91b32a4856a4c9d6dc12871ed080f7a67311ead0..0efb172c31a211e03d5fd922f65b6fef
|
||||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@@ -420,6 +422,11 @@ public class Commands {
|
@@ -421,6 +423,11 @@ public class Commands {
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
|
|
|
@ -35,10 +35,10 @@ index 6fdbe747645eb83f31b56bca77a9d7962237aed8..dd0143f319d4adef8834c513af34b1cc
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
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
|
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||||
+++ b/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<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
|
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
|
||||||
Iterator iterator = tree.getChildren().iterator();
|
Iterator iterator = tree.getChildren().iterator();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ index 6d480d0332ee9348eacc3269890ee49206623c2a..584d2539d715fef26a2d01f014c7c3f4
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
// Paper start
|
// Paper start
|
||||||
@@ -458,6 +459,12 @@ public class Commands {
|
@@ -459,6 +460,12 @@ public class Commands {
|
||||||
|
|
||||||
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
||||||
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
|
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
|
||||||
|
|
Loading…
Reference in a new issue