mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Ignore AsyncCatcher setting for Command Dispatch, always force sync
Plugins were abusing this to dispatch commands async anyways. We will no longer check that flag, and force all commands to be ran sync. Use a different boolean for allowing things go to through on shutdown/restart instead. Resolves #1004 Resolves #1005
This commit is contained in:
parent
c28c88eb35
commit
1fcba9b26d
@ -14,7 +14,7 @@ big slowdown in execution but throwing an exception at same time to raise awaren
|
||||
that it is happening so that plugin authors can fix their code to stop executing commands async.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index da25a8be..5348c0cb 100644
|
||||
index da25a8bea..48379f414 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
||||
@ -22,7 +22,7 @@ index da25a8be..5348c0cb 100644
|
||||
|
||||
if (!async && s.startsWith("/")) {
|
||||
+ // Paper Start
|
||||
+ if (org.spigotmc.AsyncCatcher.enabled && !org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
+ if (!org.spigotmc.AsyncCatcher.shuttingDown && !org.bukkit.Bukkit.isPrimaryThread()) {
|
||||
+ final String fCommandLine = s;
|
||||
+ MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Command Dispatched Async: " + fCommandLine);
|
||||
+ MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Please notify author of plugin causing this execution to fix this bug! see: http://bit.ly/1oSiM6C", new Throwable());
|
||||
@ -48,7 +48,7 @@ index da25a8be..5348c0cb 100644
|
||||
} else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) {
|
||||
// Do nothing, this is coming from a plugin
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index bfddd168..082957d3 100644
|
||||
index bfddd1685..462ad1024 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
@ -56,7 +56,7 @@ index bfddd168..082957d3 100644
|
||||
Validate.notNull(commandLine, "CommandLine cannot be null");
|
||||
|
||||
+ // Paper Start
|
||||
+ if (org.spigotmc.AsyncCatcher.enabled && !Bukkit.isPrimaryThread()) {
|
||||
+ if (!org.spigotmc.AsyncCatcher.shuttingDown && !Bukkit.isPrimaryThread()) {
|
||||
+ final CommandSender fSender = sender;
|
||||
+ final String fCommandLine = commandLine;
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Command Dispatched Async: " + commandLine);
|
||||
@ -81,4 +81,40 @@ index bfddd168..082957d3 100644
|
||||
if (commandMap.dispatch(sender, commandLine)) {
|
||||
return true;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
index a0cdd2317..984df4083 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
@@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread {
|
||||
public void run() {
|
||||
try {
|
||||
org.spigotmc.AsyncCatcher.enabled = false; // Spigot
|
||||
+ org.spigotmc.AsyncCatcher.shuttingDown = true; // Paper
|
||||
server.stop();
|
||||
} catch (ExceptionWorldConflict ex) {
|
||||
ex.printStackTrace();
|
||||
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
index 4b3aa85c9..e44c23016 100644
|
||||
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
@@ -0,0 +0,0 @@ public class AsyncCatcher
|
||||
{
|
||||
|
||||
public static boolean enabled = true;
|
||||
+ public static boolean shuttingDown = false; // Paper
|
||||
|
||||
public static void catchOp(String reason)
|
||||
{
|
||||
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
index 49768734d..947c43a5d 100644
|
||||
--- a/src/main/java/org/spigotmc/RestartCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
@@ -0,0 +0,0 @@ public class RestartCommand extends Command
|
||||
public static void restart(final File script)
|
||||
{
|
||||
AsyncCatcher.enabled = false; // Disable async catcher incase it interferes with us
|
||||
+ org.spigotmc.AsyncCatcher.shuttingDown = true; // Paper
|
||||
try
|
||||
{
|
||||
if ( script.isFile() )
|
||||
--
|
@ -107,11 +107,11 @@ index 4080ed26c..ff01bbff5 100644
|
||||
// CraftBukkit start
|
||||
public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
|
||||
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
index 49768734d..d51636c8e 100644
|
||||
index 947c43a5d..f15fd9f37 100644
|
||||
--- a/src/main/java/org/spigotmc/RestartCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/RestartCommand.java
|
||||
@@ -0,0 +0,0 @@ public class RestartCommand extends Command
|
||||
AsyncCatcher.enabled = false; // Disable async catcher incase it interferes with us
|
||||
org.spigotmc.AsyncCatcher.shuttingDown = true; // Paper
|
||||
try
|
||||
{
|
||||
- if ( script.isFile() )
|
||||
|
@ -304,7 +304,7 @@ index ff01bbff5..311c0b86f 100644
|
||||
|
||||
this.k = new GameProfileBanList(PlayerList.a);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 50341ae6e..fa831dc8f 100644
|
||||
index 27c6caddc..539f492e0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ import io.netty.buffer.ByteBuf;
|
||||
@ -530,7 +530,7 @@ index 33e8ea02c..1e3aae3b8 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
index a0cdd2317..0a1812883 100644
|
||||
index 984df4083..bbb5a84f3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||
@@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread {
|
||||
|
Loading…
Reference in New Issue
Block a user