From c1b617ddc87297c1f541826ed473979df9fadb12 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 3 Mar 2013 20:23:04 +1100 Subject: [PATCH] Fix errors in command block commands crashing the server. --- ...exceptions-in-command-block-commands.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CraftBukkit-Patches/0040-Fix-crash-with-exceptions-in-command-block-commands.patch diff --git a/CraftBukkit-Patches/0040-Fix-crash-with-exceptions-in-command-block-commands.patch b/CraftBukkit-Patches/0040-Fix-crash-with-exceptions-in-command-block-commands.patch new file mode 100644 index 000000000..f948b0524 --- /dev/null +++ b/CraftBukkit-Patches/0040-Fix-crash-with-exceptions-in-command-block-commands.patch @@ -0,0 +1,30 @@ +From 5eae34496926939f89cf38aac489c996d6432cf8 Mon Sep 17 00:00:00 2001 +From: md_5 +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 +