From 60c0a1ab929b006e730f0bc18463aa7b313d9496 Mon Sep 17 00:00:00 2001 From: Jeremy Wood Date: Fri, 23 Nov 2012 12:30:11 -0500 Subject: [PATCH] Fixed world spawns not keeping pitch + yaw. Fixes #976 --- .../onarandombox/MultiverseCore/MVWorld.java | 20 +++++++------------ .../commands/SetSpawnCommand.java | 3 +++ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java index 7380213c..49302745 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MVWorld.java @@ -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(); } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java index 0e0cd96d..ef39e043 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java @@ -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).");