diff --git a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java index 88cb5244..7a4deede 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java @@ -69,7 +69,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld { private MultiverseCore plugin; // Hold the Plugin Instance. - private Reference world; // A reference to the World Instance. + private Reference world = new WeakReference(null); // A reference to the World Instance. private String name; // The Worlds Name, EG its folder name. /** @@ -404,7 +404,9 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld { private VirtualProperty spawn = new VirtualProperty() { @Override public void set(Location newValue) { - world.get().setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ()); + if (getCBWorld() != null) + getCBWorld().setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ()); + spawnLocation = new SpawnLocation(newValue); } @@ -569,7 +571,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld { this.adjustSpawn = true; this.portalForm = AllowedPortalType.ALL; this.gameMode = GameMode.SURVIVAL; - this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : null; + this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : new SpawnLocation(0, 0, 0); this.autoLoad = true; this.bedRespawn = true; this.worldBlacklist = new ArrayList(); diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 4969fc1d..7ad2af4d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -520,8 +520,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { } // migrate weather - if (section.isBoolean("weather")) { - world.setEnableWeather(section.getBoolean("weather")); + if (section.isBoolean("allowweather")) { + world.setEnableWeather(section.getBoolean("allowweather")); } // migrate adjustspawn @@ -529,6 +529,34 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { world.setAdjustSpawn(section.getBoolean("adjustspawn")); } + // migrate autoload + if (section.isBoolean("autoload")) { + world.setAutoLoad(section.getBoolean("autoload")); + } + + // migrate bedrespawn + if (section.isBoolean("bedrespawn")) { + world.setBedRespawn(section.getBoolean("bedrespawn")); + } + + // migrate spawn + if (section.isConfigurationSection("spawn")) { + ConfigurationSection spawnSect = section.getConfigurationSection("spawn"); + Location spawnLoc = world.getSpawnLocation(); + if (spawnSect.isDouble("yaw")) + spawnLoc.setYaw((float) spawnSect.getDouble("yaw")); + if (spawnSect.isDouble("pitch")) + spawnLoc.setPitch((float) spawnSect.getDouble("pitch")); + if (spawnSect.isDouble("x")) + spawnLoc.setX(spawnSect.getDouble("x")); + if (spawnSect.isDouble("y")) + spawnLoc.setY(spawnSect.getDouble("y")); + if (spawnSect.isDouble("z")) + spawnLoc.setZ(spawnSect.getDouble("z")); + + world.setSpawnLocation(spawnLoc); + } + newValues.put(entry.getKey(), world); wasChanged = true; } else {