From c655b3caf3efe3068b8e21bb99fddbd637bcb242 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Dec 2016 11:00:15 -0500 Subject: [PATCH] Respect AsyncCatcher for Async Command Detection - Fixes #555 --- .../0050-Ensure-commands-are-not-ran-async.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/0050-Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/0050-Ensure-commands-are-not-ran-async.patch index b746854e7..bd8c5f783 100644 --- a/Spigot-Server-Patches/0050-Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/0050-Ensure-commands-are-not-ran-async.patch @@ -1,4 +1,4 @@ -From 16ce00684b1104998dcda574660c2ff0954f2de7 Mon Sep 17 00:00:00 2001 +From 67e09fb94f4a77e6097e8b9c087b8d4954afe382 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 3 Mar 2016 01:17:12 -0600 Subject: [PATCH] Ensure commands are not ran async @@ -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 3330513..4d8c88a 100644 +index 2e5e0b4a7..8147b5e3c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -1258,6 +1258,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -22,7 +22,7 @@ index 3330513..4d8c88a 100644 if (!async && s.startsWith("/")) { + // Paper Start -+ if (!org.bukkit.Bukkit.isPrimaryThread()) { ++ if (org.spigotmc.AsyncCatcher.enabled && !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 3330513..4d8c88a 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 7e7be86..32de676 100644 +index 7e7be864b..63545ce40 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -646,6 +646,29 @@ public final class CraftServer implements Server { @@ -56,7 +56,7 @@ index 7e7be86..32de676 100644 Validate.notNull(commandLine, "CommandLine cannot be null"); + // Paper Start -+ if (!Bukkit.isPrimaryThread()) { ++ if (org.spigotmc.AsyncCatcher.enabled && !Bukkit.isPrimaryThread()) { + final CommandSender fSender = sender; + final String fCommandLine = commandLine; + Bukkit.getLogger().log(Level.SEVERE, "Command Dispatched Async: " + commandLine); @@ -82,5 +82,5 @@ index 7e7be86..32de676 100644 return true; } -- -2.9.3 +2.11.0