Fixed world spawns not keeping pitch + yaw. Fixes #976

This commit is contained in:
Jeremy Wood 2012-11-23 12:30:11 -05:00
parent 58eeecbcb8
commit 60c0a1ab92
2 changed files with 10 additions and 13 deletions

View File

@ -66,21 +66,19 @@ public class MVWorld implements MultiverseWorld {
this.props = properties;
setupProperties();
if (!fixSpawn) {
props.setAdjustSpawn(false);
}
// Setup spawn separately so we can use the validator with the world spawn value..
final SpawnLocationPropertyValidator spawnValidator = new SpawnLocationPropertyValidator();
final Location worldSpawnLocation = readSpawnFromWorld(world);
this.props.setValidator("spawn", spawnValidator);
this.props.spawnLocation.setWorld(world);
if (this.props.spawnLocation instanceof NullLocation) {
final SpawnLocation newLoc = new SpawnLocation(worldSpawnLocation);
final SpawnLocation newLoc = new SpawnLocation(readSpawnFromWorld(world));
this.props.spawnLocation = newLoc;
world.setSpawnLocation(newLoc.getBlockX(), newLoc.getBlockY(), newLoc.getBlockZ());
} else {
this.props.spawnLocation.setWorld(world);
if (plugin.getBlockSafety().playerCanSpawnHereSafely(this.props.spawnLocation)) {
final SpawnLocation newLoc = new SpawnLocation(worldSpawnLocation);
this.props.spawnLocation = newLoc;
world.setSpawnLocation(newLoc.getBlockX(), newLoc.getBlockY(), newLoc.getBlockZ());
}
}
this.props.environment = world.getEnvironment();
@ -90,10 +88,6 @@ public class MVWorld implements MultiverseWorld {
this.props.flushChanges();
if (!fixSpawn) {
props.setAdjustSpawn(false);
}
validateProperties();
}

View File

@ -64,6 +64,9 @@ public class SetSpawnCommand extends MultiverseCommand {
foundWorld.setAdjustSpawn(false);
}
sender.sendMessage("Spawn was set to: " + plugin.getLocationManipulation().strCoords(p.getLocation()));
if (!plugin.saveWorldConfig()) {
sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!");
}
} else {
w.setSpawnLocation(l.getBlockX(), l.getBlockY(), l.getBlockZ());
sender.sendMessage("Multiverse does not know about this world, only X,Y and Z set. Please import it to set the spawn fully (Pitch/Yaws).");