mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-19 13:38:44 +01:00
SPIGOT-6168: Fix error with Player.getBedSpawnLocation when world is unloaded while server running
By: md_5 <git@md-5.net>
This commit is contained in:
parent
753bccda7c
commit
5eb09a7d93
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue