diff options
author | riking <rikingcoding@gmail.com> | 2013-04-18 17:50:05 -0700 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2013-08-07 01:01:12 -0500 |
commit | 0506b709fe9d325725a3ef1c758b7c9843dd7310 (patch) | |
tree | 0c411cf1df2207eccc3e2552f3f5c386b5a565fc /src/main/java | |
parent | 71a6a565720eafabb072c9332619c234c0edc0d8 (diff) | |
download | craftbukkit-0506b709fe9d325725a3ef1c758b7c9843dd7310.tar craftbukkit-0506b709fe9d325725a3ef1c758b7c9843dd7310.tar.gz craftbukkit-0506b709fe9d325725a3ef1c758b7c9843dd7310.tar.lz craftbukkit-0506b709fe9d325725a3ef1c758b7c9843dd7310.tar.xz craftbukkit-0506b709fe9d325725a3ef1c758b7c9843dd7310.zip |
Wrap plugin.getDefaultWorldGenerator in try-catch. Fixes BUKKIT-4116
If a plugin generates an exception when returning a world generator, the
server will crash. This change adds a try-catch block to keep the server
from crashing on plugin defined world generators.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 51afd256..df2efe2c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1014,9 +1014,13 @@ public final class CraftServer implements Server { } else if (!plugin.isEnabled()) { getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled yet (is it load:STARTUP?)"); } else { - result = plugin.getDefaultWorldGenerator(world, id); - if (result == null) { - getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' lacks a default world generator"); + try { + result = plugin.getDefaultWorldGenerator(world, id); + if (result == null) { + getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' lacks a default world generator"); + } + } catch (Throwable t) { + plugin.getLogger().log(Level.SEVERE, "Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName(), t); } } } |