13
0
geforkt von Mirrors/Paper

Respect AsyncCatcher for Async Command Detection - Fixes #555

Dieser Commit ist enthalten in:
Aikar 2016-12-27 11:00:15 -05:00
Ursprung 043859300f
Commit c655b3caf3

Datei anzeigen

@ -1,4 +1,4 @@
From 16ce00684b1104998dcda574660c2ff0954f2de7 Mon Sep 17 00:00:00 2001
From 67e09fb94f4a77e6097e8b9c087b8d4954afe382 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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