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
parent 283a4b7d60
commit 680e0ad864
3 changed files with 19 additions and 8 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 498dfd33..4f27b9f2 100644
index 5431b17b..ed403c33 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -0,0 +0,0 @@ public final class Bukkit {
@ -27,7 +27,7 @@ index 498dfd33..4f27b9f2 100644
public static Server.Spigot spigot()
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4f077b7c..3a27e3ae 100644
index 83b370e5..87ab9d2b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient {
@ -46,7 +46,7 @@ index 4f077b7c..3a27e3ae 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java
index 3bfa31fc..dbbf0a42 100644
index 2abe1208..c660c178 100644
--- a/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/src/main/java/org/bukkit/command/PluginCommand.java
@@ -0,0 +0,0 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
@ -57,4 +57,6 @@ index 3bfa31fc..dbbf0a42 100644
return super.tabComplete(sender, alias, args);
}
return completions;
--
--
2.17.0 (Apple Git-106)

View File

@ -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
@@ -0,0 +0,0 @@ import java.util.List;
@ -472,6 +472,11 @@ index bdc0de8c..762eb1d2 100644
import org.bukkit.Location;
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
} 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
@ -586,4 +591,6 @@ index 80c152ba..b88f31ca 100644
}
}
}
--
--
2.17.0 (Apple Git-106)

View File

@ -55,7 +55,7 @@ index 30d60247..938959aa 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 762eb1d2..23d08336 100644
index 4aea03c6..63d27392 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
@ -96,4 +96,6 @@ index f331a442..a977045d 100644
} else if ("confirm".equalsIgnoreCase(args[0])) {
confirmed = true;
} else {
--
--
2.17.0 (Apple Git-106)