Paper/CraftBukkit-Patches/0040-Fix-crash-with-exceptions-in-command-block-commands.patch

31 Zeilen
1.4 KiB
Diff

From 5eae34496926939f89cf38aac489c996d6432cf8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Mar 2013 20:22:45 +1100
Subject: [PATCH] Fix crash with exceptions in command block commands.
---
src/main/java/net/minecraft/server/TileEntityCommand.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java
index 4ff401b..10215ec 100644
--- a/src/main/java/net/minecraft/server/TileEntityCommand.java
+++ b/src/main/java/net/minecraft/server/TileEntityCommand.java
@@ -70,7 +70,12 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
// now dispatch all of the commands we ended up with
for (int i = 0; i < commands.size(); i++) {
- commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))));
+ String[] cmd = commands.get(i);
+ try {
+ commandMap.dispatch(sender, joiner.join(Arrays.asList(cmd)));
+ } catch (org.bukkit.command.CommandException ex) {
+ org.bukkit.Bukkit.getServer().getLogger().log(java.util.logging.Level.WARNING, "Unexpected exception while parsing command block command \"" + cmd[0] + '"', ex);
+ }
}
// CraftBukkit end
}
--
1.8.1-rc2