summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-06-22 18:27:27 +0100
committerDinnerbone <dinnerbone@dinnerbone.com>2011-06-22 18:27:52 +0100
commit7f0126a364ee8a1419424dc09ca0cfc488236373 (patch)
tree3df73d05cd26037ac6c6d243c71120551638a84f /src/main/java/org
parentd647e2098eb48c51fff9d200be1d71b94b2ade6b (diff)
downloadcraftbukkit-7f0126a364ee8a1419424dc09ca0cfc488236373.tar
craftbukkit-7f0126a364ee8a1419424dc09ca0cfc488236373.tar.gz
craftbukkit-7f0126a364ee8a1419424dc09ca0cfc488236373.tar.lz
craftbukkit-7f0126a364ee8a1419424dc09ca0cfc488236373.tar.xz
craftbukkit-7f0126a364ee8a1419424dc09ca0cfc488236373.zip
You may now set a generator to a default world using plugin.yml
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a7cc8e4c..86f7cf55 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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;
+ }
}