Added 'generate-structure' setting support and WorldCreator property.

Fixes BUKKIT-655 and BUKKIT-592
Dieser Commit ist enthalten in:
Eric Stokes 2012-01-29 10:40:45 -07:00 committet von EvilSeph
Ursprung f1a35effb0
Commit 3a419481ea
3 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -217,6 +217,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
j = WorldSettings.a(j); j = WorldSettings.a(j);
log.info("Default game type: " + j); log.info("Default game type: " + j);
// CraftBukkit start (+ removed worldsettings and servernbtmanager) // CraftBukkit start (+ removed worldsettings and servernbtmanager)
boolean generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int worldCount = 3; int worldCount = 3;
for (int k = 0; k < worldCount; ++k) { for (int k = 0; k < worldCount; ++k) {
@ -244,7 +245,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
String name = (dimension == 0) ? s : s + "_" + worldType; String name = (dimension == 0) ? s : s + "_" + worldType;
ChunkGenerator gen = this.server.getGenerator(name); ChunkGenerator gen = this.server.getGenerator(name);
WorldSettings settings = new WorldSettings(i, j, true, false, worldtype); WorldSettings settings = new WorldSettings(i, j, generateStructures, false, worldtype);
if (k == 0) { if (k == 0) {
world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit

Datei anzeigen

@ -521,6 +521,7 @@ public final class CraftServer implements Server {
File folder = new File(getWorldContainer(), name); File folder = new File(getWorldContainer(), name);
World world = getWorld(name); World world = getWorld(name);
WorldType type = WorldType.a(creator.type().getName()); WorldType type = WorldType.a(creator.type().getName());
boolean generateStructures = creator.generateStructures();
if (world != null) { if (world != null) {
return world; return world;
@ -552,7 +553,8 @@ public final class CraftServer implements Server {
} }
} while(used); } while(used);
boolean hardcore = false; boolean hardcore = false;
WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), true, hardcore, type), creator.environment(), generator);
WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), generateStructures, hardcore, type), creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase()))) { if (!(worlds.containsKey(name.toLowerCase()))) {
return null; return null;

Datei anzeigen

@ -978,4 +978,8 @@ public class CraftWorld implements World {
public org.bukkit.WorldType getWorldType() { public org.bukkit.WorldType getWorldType() {
return org.bukkit.WorldType.getByName(world.getWorldData().getType().name()); return org.bukkit.WorldType.getByName(world.getWorldData().getType().name());
} }
public boolean canGenerateStructures() {
return world.getWorldData().o();
}
} }