diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-09-06 22:11:17 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-09-06 22:11:17 -0500 |
commit | 4d5894e4cb29bfa4f9bb07edfb85f57363a8866e (patch) | |
tree | 9713cc1c47fb6092e6b7af10b3a951e715f1ad2f /src/main/java/org/bukkit | |
parent | c710ca827f6a58b9464a94945f0e3b54e83fabbd (diff) | |
download | craftbukkit-4d5894e4cb29bfa4f9bb07edfb85f57363a8866e.tar craftbukkit-4d5894e4cb29bfa4f9bb07edfb85f57363a8866e.tar.gz craftbukkit-4d5894e4cb29bfa4f9bb07edfb85f57363a8866e.tar.lz craftbukkit-4d5894e4cb29bfa4f9bb07edfb85f57363a8866e.tar.xz craftbukkit-4d5894e4cb29bfa4f9bb07edfb85f57363a8866e.zip |
Fix crash from console-commands throwing exception. Fixes BUKKIT-2479
When 1.3.1 was released, a try-catch block was removed from the tick
loop that called the method in NMS to handle commands. This restores a
try-catch to prevent the console from crashing the server.
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 500c4909..f11f7329 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -485,7 +485,12 @@ public final class CraftServer implements Server { return true; } } - return dispatchCommand(sender, serverCommand.command); + try { + return dispatchCommand(sender, serverCommand.command); + } catch (Exception ex) { + getLogger().log(Level.WARNING, "Unexpected exception while parsing console command \"" + serverCommand.command + '"', ex); + return false; + } } public boolean dispatchCommand(CommandSender sender, String commandLine) { |