Forgot some values, fixed allowweather migration

This commit is contained in:
main() 2012-05-01 16:48:18 +02:00
parent 0efb28be19
commit 9b2dd0d6c9
2 changed files with 35 additions and 5 deletions

View File

@ -69,7 +69,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private MultiverseCore plugin; // Hold the Plugin Instance. private MultiverseCore plugin; // Hold the Plugin Instance.
private Reference<World> world; // A reference to the World Instance. private Reference<World> world = new WeakReference<World>(null); // A reference to the World Instance.
private String name; // The Worlds Name, EG its folder name. private String name; // The Worlds Name, EG its folder name.
/** /**
@ -404,7 +404,9 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private VirtualProperty<Location> spawn = new VirtualProperty<Location>() { private VirtualProperty<Location> spawn = new VirtualProperty<Location>() {
@Override @Override
public void set(Location newValue) { 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); spawnLocation = new SpawnLocation(newValue);
} }
@ -569,7 +571,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
this.adjustSpawn = true; this.adjustSpawn = true;
this.portalForm = AllowedPortalType.ALL; this.portalForm = AllowedPortalType.ALL;
this.gameMode = GameMode.SURVIVAL; 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.autoLoad = true;
this.bedRespawn = true; this.bedRespawn = true;
this.worldBlacklist = new ArrayList<String>(); this.worldBlacklist = new ArrayList<String>();

View File

@ -520,8 +520,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
} }
// migrate weather // migrate weather
if (section.isBoolean("weather")) { if (section.isBoolean("allowweather")) {
world.setEnableWeather(section.getBoolean("weather")); world.setEnableWeather(section.getBoolean("allowweather"));
} }
// migrate adjustspawn // migrate adjustspawn
@ -529,6 +529,34 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
world.setAdjustSpawn(section.getBoolean("adjustspawn")); 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); newValues.put(entry.getKey(), world);
wasChanged = true; wasChanged = true;
} else { } else {