mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
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.
This commit is contained in:
parent
71a6a56572
commit
0506b709fe
1 changed files with 7 additions and 3 deletions
|
@ -1014,9 +1014,13 @@ public final class CraftServer implements Server {
|
||||||
} else if (!plugin.isEnabled()) {
|
} 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?)");
|
getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled yet (is it load:STARTUP?)");
|
||||||
} else {
|
} else {
|
||||||
result = plugin.getDefaultWorldGenerator(world, id);
|
try {
|
||||||
if (result == null) {
|
result = plugin.getDefaultWorldGenerator(world, id);
|
||||||
getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' lacks a default world generator");
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue