Fixed UOE when temporarily saving the NullLocation to the config

This commit is contained in:
main() 2012-05-01 17:43:05 +02:00
parent a4196a901a
commit 02347e05d8
1 changed files with 22 additions and 6 deletions

View File

@ -466,10 +466,12 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
super.copyValues(other); super.copyValues(other);
} }
/** @SerializableAs("MVNullLocation (It's a bug if you see this in your config file)")
* That's the spawn-location when the MVWorld-object wasn't property initialized. private static final class NullLocation extends SpawnLocation {
*/ public NullLocation() {
public static final SpawnLocation NULL_LOCATION = new SpawnLocation(0, -1, 0) { super(0, -1, 0);
}
@Override @Override
public Location clone() { public Location clone() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@ -477,7 +479,16 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
throw new UnsupportedOperationException(); return Collections.EMPTY_MAP;
}
/**
* Let Bukkit be able to deserialize this.
* @param args The map.
* @return The deserialized object.
*/
public static NullLocation deserialize(Map<String, Object> args) {
return new NullLocation();
} }
@Override @Override
@ -494,7 +505,12 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
public String toString() { public String toString() {
return "NULL LOCATION"; return "NULL LOCATION";
}; };
}; }
/**
* That's the spawn-location when the MVWorld-object wasn't property initialized.
*/
public static final SpawnLocation NULL_LOCATION = new NullLocation();
/** /**
* Sets the CB-World. * Sets the CB-World.