From 5eb09a7d931162bdaa9430a0f4e65e1ad0b4a835 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 6 Oct 2020 18:36:43 +1100 Subject: [PATCH] SPIGOT-6168: Fix error with Player.getBedSpawnLocation when world is unloaded while server running By: md_5 --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 5d3b514e16..c5f943d5a0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -720,14 +720,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public Location getBedSpawnLocation() { - World world = getHandle().server.getWorldServer(getHandle().getSpawnDimension()).getWorld(); + WorldServer world = getHandle().server.getWorldServer(getHandle().getSpawnDimension()); BlockPosition bed = getHandle().getSpawn(); if (world != null && bed != null) { - Optional spawnLoc = EntityHuman.getBed(((CraftWorld) world).getHandle(), bed, getHandle().getSpawnAngle(), getHandle().isSpawnForced(), true); + Optional spawnLoc = EntityHuman.getBed(world, bed, getHandle().getSpawnAngle(), getHandle().isSpawnForced(), true); if (spawnLoc.isPresent()) { 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;