You may now set a generator to a default world using plugin.yml

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2011-06-22 18:27:27 +01:00
parent 59c6da8305
commit 92365a5bf2

View File

@ -576,4 +576,33 @@ public final class CraftServer implements Server {
public boolean getOnlineMode() {
return this.console.onlineMode;
}
public ChunkGenerator getGenerator(String world) {
ConfigurationNode node = configuration.getNode("worlds");
ChunkGenerator result = null;
if (node != null) {
node = node.getNode(world);
if (node != null) {
String name = node.getString("generator");
if ((name != null) && (!name.isEmpty())) {
String[] split = name.split(":", 2);
String id = (split.length > 1) ? split[1] : null;
Plugin plugin = pluginManager.getPlugin(split[0]);
if (plugin == null) {
getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + split[0] + "' does not exist");
} else if (!plugin.isEnabled()) {
getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + split[0] + "' is not enabled yet (is it load:STARTUP?)");
} else {
result = plugin.getDefaultWorldGenerator(world, id);
}
}
}
}
return result;
}
}