summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2013-01-29 10:03:05 -0600
committerfeildmaster <admin@feildmaster.com>2013-01-29 10:11:57 -0600
commit37975946a274889c647294283afa6c1366481264 (patch)
tree506828fcc92416928d111a3f1cb7308b99bf83db /src/main/java/org
parent0576395ddd66d5c197fa9667885c238de92f4566 (diff)
downloadcraftbukkit-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/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java9
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;
}