Now caches the world properties before unloading the world in order to prevent NPE on unload then load. Really fixes #947.

This commit is contained in:
Jeremy Wood 2012-11-15 09:30:19 -05:00
parent e5537dd8f1
commit cce1ccc967
3 changed files with 2 additions and 15 deletions

View File

@ -373,17 +373,6 @@ public class MVWorld implements MultiverseWorld {
};
}
/**
* This prepares the MVWorld for unloading.
*/
public void tearDown() {
try {
this.props.tearDown();
} catch (IllegalStateException e) {
// do nothing
}
}
/**
* Initializes permissions.
*/

View File

@ -297,7 +297,7 @@ public class WorldProperties extends SerializationConfig {
/**
* This prepares the MVWorld for unloading.
*/
public void tearDown() {
public void cacheVirtualProperties() {
try {
this.buildVPropChanges();
} catch (IllegalStateException e) {

View File

@ -311,12 +311,10 @@ public class WorldManager implements MVWorldManager {
@Override
public boolean unloadWorld(String name) {
if (this.worlds.containsKey(name)) {
this.worldsFromTheConfig.get(name).cacheVirtualProperties();
if (this.unloadWorldFromBukkit(name, true)) {
this.worlds.remove(name);
Logging.info("World '%s' was unloaded from memory.", name);
this.worldsFromTheConfig.get(name).tearDown();
return true;
} else {
Logging.warning("World '%s' could not be unloaded. Is it a default world?", name);