That's the way it should be.

This commit is contained in:
main() 2012-05-03 16:20:59 +02:00
parent 48768b5d6c
commit 21a3eeacc8
2 changed files with 20 additions and 8 deletions

View File

@ -341,7 +341,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private String alias; private String alias;
@Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'color' must be a valid color-name.") @Property(serializor = EnumPropertySerializor.class, description = "Sorry, 'color' must be a valid color-name.")
private EnglishChatColor color; private EnglishChatColor color;
@Property(description = "Sorry, 'pvp' must either be: true or false.", virtualType = Boolean.class) @Property(description = "Sorry, 'pvp' must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
private VirtualProperty<Boolean> pvp = new VirtualProperty<Boolean>() { private VirtualProperty<Boolean> pvp = new VirtualProperty<Boolean>() {
@Override @Override
public void set(Boolean newValue) { public void set(Boolean newValue) {
@ -359,7 +359,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
private String respawnWorld; private String respawnWorld;
@Property(validator = AllowWeatherPropertyValidator.class, description = "Sorry, this must either be: true or false.") @Property(validator = AllowWeatherPropertyValidator.class, description = "Sorry, this must either be: true or false.")
private boolean allowWeather; private boolean allowWeather;
@Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class, @Property(serializor = DifficultyPropertySerializor.class, virtualType = Difficulty.class, persistVirtual = true,
description = "Difficulty must be set as one of the following: peaceful easy normal hard") description = "Difficulty must be set as one of the following: peaceful easy normal hard")
private VirtualProperty<Difficulty> difficulty = new VirtualProperty<Difficulty>() { private VirtualProperty<Difficulty> difficulty = new VirtualProperty<Difficulty>() {
@Override @Override
@ -387,19 +387,16 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
@Property(serializor = GameModePropertySerializor.class, validator = GameModePropertyValidator.class, @Property(serializor = GameModePropertySerializor.class, validator = GameModePropertyValidator.class,
description = "GameMode must be set as one of the following: survival creative") description = "GameMode must be set as one of the following: survival creative")
private GameMode gameMode; private GameMode gameMode;
@Property @Property(description = "Sorry, this must either be: true or false.", virtualType = Boolean.class, persistVirtual = true)
private boolean keepSpawnLoaded;
@Property(description = "Sorry, this must either be: true or false.", virtualType = Boolean.class)
private VirtualProperty<Boolean> keepSpawnInMemory = new VirtualProperty<Boolean>() { private VirtualProperty<Boolean> keepSpawnInMemory = new VirtualProperty<Boolean>() {
@Override @Override
public void set(Boolean newValue) { public void set(Boolean newValue) {
world.get().setKeepSpawnInMemory(newValue); world.get().setKeepSpawnInMemory(newValue);
keepSpawnLoaded = newValue;
} }
@Override @Override
public Boolean get() { public Boolean get() {
return keepSpawnLoaded; return world.get().getKeepSpawnInMemory();
} }
}; };
@Property @Property
@ -534,6 +531,19 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
this.spawnLocation = new SpawnLocation(readSpawnFromWorld(cbWorld)); this.spawnLocation = new SpawnLocation(readSpawnFromWorld(cbWorld));
this.initPerms(); this.initPerms();
this.flushPendingVPropChanges();
}
/**
* This prepares the MVWorld for unloading.
*/
public void tearDown() {
try {
this.buildVPropChanges();
} catch (IllegalStateException e) {
// do nothing
}
} }
/** /**
@ -626,7 +636,6 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
this.bedRespawn = true; this.bedRespawn = true;
this.worldBlacklist = new ArrayList<String>(); this.worldBlacklist = new ArrayList<String>();
this.generator = null; this.generator = null;
this.keepSpawnLoaded = true;
} }
/** /**

View File

@ -226,6 +226,9 @@ public class WorldManager implements MVWorldManager {
if (this.unloadWorldFromBukkit(name, true)) { if (this.unloadWorldFromBukkit(name, true)) {
this.worlds.remove(name); this.worlds.remove(name);
this.plugin.log(Level.INFO, "World '" + name + "' was unloaded from memory."); this.plugin.log(Level.INFO, "World '" + name + "' was unloaded from memory.");
this.worldsFromTheConfig.get(name).tearDown();
return true; return true;
} else { } else {
this.plugin.log(Level.WARNING, "World '" + name + "' could not be unloaded. Is it a default world?"); this.plugin.log(Level.WARNING, "World '" + name + "' could not be unloaded. Is it a default world?");