Fix PluginCommand to not wrap exceptions before ServerExceptionEvent can get to it (#1130)

This commit is contained in:
theminecoder 2018-06-19 07:03:09 +10:00 committed by Zach
parent efb52083b9
commit b02d49beaa
3 changed files with 19 additions and 14 deletions

View file

@ -1,4 +1,4 @@
From 95df32df8d98c5ca8434f09312bade707628c21c Mon Sep 17 00:00:00 2001
From b8567d82eae818cbf98656b6107c703d49d19916 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 20:24:35 -0600
Subject: [PATCH] Add exception reporting event
@ -458,7 +458,7 @@ index 00000000..5582999f
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index bdc0de8c..762eb1d2 100644
index bdc0de8c..4aea03c6 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -10,6 +10,9 @@ import java.util.List;
@ -471,7 +471,12 @@ index bdc0de8c..762eb1d2 100644
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -152,7 +155,9 @@ public class SimpleCommandMap implements CommandMap {
@@ -148,11 +151,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
target.timings.stopTiming(); // Spigot
} catch (CommandException ex) {
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
target.timings.stopTiming(); // Spigot
throw ex;
} catch (Throwable ex) {
target.timings.stopTiming(); // Spigot
@ -482,7 +487,7 @@ index bdc0de8c..762eb1d2 100644
}
// return true as command was handled
@@ -225,7 +230,9 @@ public class SimpleCommandMap implements CommandMap {
@@ -225,7 +231,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) {
throw ex;
} catch (Throwable ex) {
@ -587,5 +592,5 @@ index 80c152ba..b88f31ca 100644
}
}
--
2.14.3
2.17.0 (Apple Git-106)