[Bleeding] Fix NPE with a null bedSpawnLocation. Fixes BUKKIT-1500

By: EdGruberman <ed@rjump.com>
This commit is contained in:
CraftBukkit/Spigot 2012-12-09 17:37:37 -06:00
parent 7aea414399
commit 3f11c5df16

View File

@ -614,8 +614,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setBedSpawnLocation(Location location, boolean override) {
getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
getHandle().spawnWorld = location.getWorld().getName();
if (location == null) {
getHandle().setRespawnPosition(null, override);
} else {
getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
getHandle().spawnWorld = location.getWorld().getName();
}
}
public void hidePlayer(Player player) {