Improve Timings stack protection more

Ensures in more places that exceptions will not corrupt the Timings stack.

Timings will now better report stack corruption and auto repair itself too.
This commit is contained in:
Aikar
2019-03-26 00:31:34 -04:00
parent 9329e1383d
commit 92059ef6ba
3 changed files with 35 additions and 15 deletions

View File

@@ -462,7 +462,7 @@ index 000000000..5582999fe
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index f7ec2e55f..f52d91d19 100644
index 6a786b8c5..682d27f94 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -0,0 +0,0 @@ import java.util.Iterator;
@@ -477,13 +477,13 @@ index f7ec2e55f..f52d91d19 100644
import org.bukkit.Server;
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
target.timings.stopTiming(); // Spigot
} // target.timings.stopTiming(); // Spigot // Paper
} catch (CommandException ex) {
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
target.timings.stopTiming(); // Spigot
//target.timings.stopTiming(); // Spigot // Paper
throw ex;
} catch (Throwable ex) {
target.timings.stopTiming(); // Spigot
//target.timings.stopTiming(); // Spigot // Paper
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper