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

This commit is contained in:
EdGruberman 2012-12-09 17:37:37 -06:00 committed by feildmaster
parent 4d2a92ed47
commit f18b3cdc76
2 changed files with 7 additions and 2 deletions

View file

@ -1094,6 +1094,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else {
this.c = null;
this.d = false;
this.spawnWorld = ""; // CraftBukkit
}
}

View file

@ -614,9 +614,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setBedSpawnLocation(Location location, boolean override) {
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) {
Validate.notNull(player, "hidden player cannot be null");