diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-09-25 01:05:10 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-09-25 01:05:10 +0100 |
commit | 1fbd439dc535436765459a885772880af6b50864 (patch) | |
tree | 6c28a028977b2a590966053fa63a1a5903cf8224 /src/main | |
parent | 44136f2e7dc2720bbd88234a7e3e4b232d4f500d (diff) | |
download | craftbukkit-1fbd439dc535436765459a885772880af6b50864.tar craftbukkit-1fbd439dc535436765459a885772880af6b50864.tar.gz craftbukkit-1fbd439dc535436765459a885772880af6b50864.tar.lz craftbukkit-1fbd439dc535436765459a885772880af6b50864.tar.xz craftbukkit-1fbd439dc535436765459a885772880af6b50864.zip |
Implemented new createWorld method
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 482405c9..1a3578e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -462,18 +462,28 @@ public final class CraftServer implements Server { } public World createWorld(String name, World.Environment environment) { - return createWorld(name, environment, (new Random()).nextLong()); + return WorldCreator.name(name).environment(environment).createWorld(); } public World createWorld(String name, World.Environment environment, long seed) { - return createWorld(name, environment, seed, null); + return WorldCreator.name(name).environment(environment).seed(seed).createWorld(); } public World createWorld(String name, Environment environment, ChunkGenerator generator) { - return createWorld(name, environment, (new Random()).nextLong(), generator); + return WorldCreator.name(name).environment(environment).generator(generator).createWorld(); } public World createWorld(String name, Environment environment, long seed, ChunkGenerator generator) { + return WorldCreator.name(name).environment(environment).seed(seed).generator(generator).createWorld(); + } + + public World createWorld(WorldCreator creator) { + if (creator == null) { + throw new IllegalArgumentException("Creator may not be null"); + } + + String name = creator.name(); + ChunkGenerator generator = creator.generator(); File folder = new File(name); World world = getWorld(name); @@ -496,7 +506,7 @@ public final class CraftServer implements Server { } int dimension = 10 + console.worlds.size(); - WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, dimension, new WorldSettings(seed, getDefaultGameMode().getValue(), true), environment, generator); + WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true), creator.environment(), generator); if (!(worlds.containsKey(name.toLowerCase()))) { return null; |