From 92365a5bf2e245b0e4aa9f7213324e1fec693614 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 22 Jun 2011 18:27:27 +0100 Subject: [PATCH] You may now set a generator to a default world using plugin.yml By: Dinnerbone --- .../org/bukkit/craftbukkit/CraftServer.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index a7cc8e4c73..86f7cf5539 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -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; + } }