SPIGOT-6168: Fix error with Player.getBedSpawnLocation when world is unloaded while server running
This commit is contained in:
parent
aa8206a857
commit
1f4693a8c3
@ -720,14 +720,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getBedSpawnLocation() {
|
public Location getBedSpawnLocation() {
|
||||||
World world = getHandle().server.getWorldServer(getHandle().getSpawnDimension()).getWorld();
|
WorldServer world = getHandle().server.getWorldServer(getHandle().getSpawnDimension());
|
||||||
BlockPosition bed = getHandle().getSpawn();
|
BlockPosition bed = getHandle().getSpawn();
|
||||||
|
|
||||||
if (world != null && bed != null) {
|
if (world != null && bed != null) {
|
||||||
Optional<Vec3D> spawnLoc = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().getSpawnAngle(), getHandle().isSpawnForced(), true);
|
Optional<Vec3D> spawnLoc = EntityHuman.getBed(world, bed, getHandle().getSpawnAngle(), getHandle().isSpawnForced(), true);
|
||||||
if (spawnLoc.isPresent()) {
|
if (spawnLoc.isPresent()) {
|
||||||
Vec3D vec = spawnLoc.get();
|
Vec3D vec = spawnLoc.get();
|
||||||
return new Location(world, vec.x, vec.y, vec.z);
|
return new Location(world.getWorld(), vec.x, vec.y, vec.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user