diff options
author | feildmaster <admin@feildmaster.com> | 2013-01-29 10:03:05 -0600 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2013-01-29 10:11:57 -0600 |
commit | 37975946a274889c647294283afa6c1366481264 (patch) | |
tree | 506828fcc92416928d111a3f1cb7308b99bf83db /src | |
parent | 0576395ddd66d5c197fa9667885c238de92f4566 (diff) | |
download | craftbukkit-37975946a274889c647294283afa6c1366481264.tar craftbukkit-37975946a274889c647294283afa6c1366481264.tar.gz craftbukkit-37975946a274889c647294283afa6c1366481264.tar.lz craftbukkit-37975946a274889c647294283afa6c1366481264.tar.xz craftbukkit-37975946a274889c647294283afa6c1366481264.zip |
Fix contract with Player.getBedSpawnLocation. Fixes BUKKIT-3525
Getting the bed spawn location is supposed to check if the bed is
valid, however, it currently did not do so.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index f0e24d2f..6adc3cd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -608,8 +608,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public Location getBedSpawnLocation() { World world = getServer().getWorld(getHandle().spawnWorld); - if ((world != null) && (getHandle().getBed() != null)) { - return new Location(world, getHandle().getBed().x, getHandle().getBed().y, getHandle().getBed().z); + ChunkCoordinates bed = getHandle().getBed(); + + if (world != null) { + bed = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().isRespawnForced()); + if (bed != null) { + return new Location(world, bed.x, bed.y, bed.z); + } } return null; } |