mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-07 03:11:02 +01:00
Fixed spawn location loading
This commit is contained in:
parent
9b2dd0d6c9
commit
a4196a901a
@ -39,6 +39,7 @@ import org.bukkit.configuration.serialization.SerializableAs;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -465,6 +466,36 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
||||
super.copyValues(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* That's the spawn-location when the MVWorld-object wasn't property initialized.
|
||||
*/
|
||||
public static final SpawnLocation NULL_LOCATION = new SpawnLocation(0, -1, 0) {
|
||||
@Override
|
||||
public Location clone() {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector toVector() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return -1;
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NULL LOCATION";
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the CB-World.
|
||||
* <p>
|
||||
@ -480,7 +511,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
||||
this.environment = cbWorld.getEnvironment();
|
||||
this.seed = cbWorld.getSeed();
|
||||
this.name = cbWorld.getName();
|
||||
if (this.spawnLocation == null)
|
||||
if (this.spawnLocation == NULL_LOCATION)
|
||||
this.spawnLocation = new SpawnLocation(readSpawnFromWorld(cbWorld));
|
||||
|
||||
this.initPerms();
|
||||
@ -571,7 +602,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()) : new SpawnLocation(0, 0, 0);
|
||||
this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : NULL_LOCATION;
|
||||
this.autoLoad = true;
|
||||
this.bedRespawn = true;
|
||||
this.worldBlacklist = new ArrayList<String>();
|
||||
|
Loading…
Reference in New Issue
Block a user