mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 11:05:13 +01:00
Improved handling of being sent to your bed spawn if the world saved in your player.dat no longer exists.
This commit is contained in:
parent
a98f4f8934
commit
a9e7b56ef2
1 changed files with 5 additions and 5 deletions
|
@ -64,22 +64,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||||
public void a(World world) {
|
public void a(World world) {
|
||||||
super.a(world);
|
super.a(world);
|
||||||
// CraftBukkit - world fallback code, either respawn location or global spawn
|
// CraftBukkit - world fallback code, either respawn location or global spawn
|
||||||
if(world == null) {
|
if (world == null) {
|
||||||
dead = false;
|
dead = false;
|
||||||
ChunkCoordinates position = null;
|
ChunkCoordinates position = null;
|
||||||
if (!spawnWorld.isEmpty()) {
|
if (!spawnWorld.isEmpty()) {
|
||||||
CraftWorld cw = (CraftWorld)Bukkit.getServer().getWorld(spawnWorld);
|
CraftWorld cw = (CraftWorld)Bukkit.getServer().getWorld(spawnWorld);
|
||||||
if (cw != null) {
|
if (cw != null && M() != null) {
|
||||||
world = cw.getHandle();
|
world = cw.getHandle();
|
||||||
position = M();
|
position = EntityHuman.getBed(cw.getHandle(), M());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (world == null) {
|
if (world == null || position == null) {
|
||||||
world = ((CraftWorld)Bukkit.getServer().getWorlds().get(0)).getHandle();
|
world = ((CraftWorld)Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||||
position = world.getSpawn();
|
position = world.getSpawn();
|
||||||
}
|
}
|
||||||
this.world = world;
|
this.world = world;
|
||||||
setPosition(position.x, position.y, position.z);
|
setPosition(position.x + 0.5, position.y, position.z + 0.5);
|
||||||
}
|
}
|
||||||
this.dimension = ((WorldServer)this.world).dimension;
|
this.dimension = ((WorldServer)this.world).dimension;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
Loading…
Reference in a new issue