From f18b3cdc769e145c0823f4b43ff4f8271fdfb617 Mon Sep 17 00:00:00 2001 From: EdGruberman Date: Sun, 9 Dec 2012 17:37:37 -0600 Subject: [Bleeding] Fix NPE with a null bedSpawnLocation. Fixes BUKKIT-1500 --- src/main/java/net/minecraft/server/EntityHuman.java | 1 + src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 64abd730..1e5723d3 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -1094,6 +1094,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } else { this.c = null; this.d = false; + this.spawnWorld = ""; // CraftBukkit } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index efa4e05a..3c1ff730 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -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) { -- cgit v1.2.3