mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
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.
This commit is contained in:
parent
0576395ddd
commit
37975946a2
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue