diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-22 18:27:27 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-22 18:27:52 +0100 |
commit | 7f0126a364ee8a1419424dc09ca0cfc488236373 (patch) | |
tree | 3df73d05cd26037ac6c6d243c71120551638a84f /src/main/java/net | |
parent | d647e2098eb48c51fff9d200be1d71b94b2ade6b (diff) | |
download | craftbukkit-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/net')
-rw-r--r-- | src/main/java/net/minecraft/server/MinecraftServer.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 81e36680..00cd628c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -24,7 +24,9 @@ import org.bukkit.craftbukkit.LoggerOutputStream; import org.bukkit.craftbukkit.command.ColouredConsoleSender; import org.bukkit.craftbukkit.scheduler.CraftScheduler; import org.bukkit.craftbukkit.util.ServerShutdownThread; +import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldSaveEvent; +import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.PluginLoadOrder; // CraftBukkit @@ -168,12 +170,14 @@ public class MinecraftServer implements Runnable, ICommandListener { for (int j = 0; j < (this.propertyManager.getBoolean("allow-nether", true) ? 2 : 1); ++j) { WorldServer world; int dimension = j == 0 ? 0 : -1; + String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); + String name = (dimension == 0) ? s : s + "_" + worldType; + + ChunkGenerator gen = server.getGenerator(name); if (j == 0) { - world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), null); // CraftBukkit + world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit } else { - String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); - String name = s + "_" + worldType; String dim = "DIM-1"; File newWorld = new File(new File(name), dim); @@ -202,9 +206,15 @@ public class MinecraftServer implements Runnable, ICommandListener { } } - world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), null); // CraftBukkit + world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit + } + + if (gen != null) { + world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld())); } + server.getPluginManager().callEvent(new WorldInitEvent(world.getWorld())); + world.tracker = new EntityTracker(this, dimension); world.addIWorldAccess(new WorldManager(this, world)); world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0; |