mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 11:15:57 -07:00
Implements a World UID.
This commit is contained in:
@@ -910,7 +910,7 @@ public abstract class Entity {
|
||||
nbttagcompound.a("Air", (short) this.airTicks);
|
||||
nbttagcompound.a("OnGround", this.onGround);
|
||||
// CraftBukkit start
|
||||
nbttagcompound.setString("World", this.world.worldData.name);
|
||||
nbttagcompound.setLong("WorldUID", this.world.worldData.getWorldUID());
|
||||
nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
||||
nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
||||
// CraftBukkit end
|
||||
@@ -982,17 +982,24 @@ public abstract class Entity {
|
||||
org.bukkit.Server server = Bukkit.getServer();
|
||||
org.bukkit.World bworld = null;
|
||||
|
||||
// TODO: Remove World related checks, replaced with WorldUID.
|
||||
if (this instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) this;
|
||||
String worldName = nbttagcompound.getString("World");
|
||||
|
||||
if (worldName == "") {
|
||||
if (nbttagcompound.hasKey("WorldUID")) {
|
||||
bworld = server.getWorld(nbttagcompound.getLong("WorldUID"));
|
||||
} else if ("".equals(worldName)) {
|
||||
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
|
||||
} else {
|
||||
bworld = server.getWorld(worldName);
|
||||
}
|
||||
} else {
|
||||
bworld = server.getWorld(nbttagcompound.getString("World"));
|
||||
if (nbttagcompound.hasKey("WorldUID")) {
|
||||
bworld = server.getWorld(nbttagcompound.getLong("WorldUID"));
|
||||
} else {
|
||||
bworld = server.getWorld(nbttagcompound.getString("World"));
|
||||
}
|
||||
}
|
||||
|
||||
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());
|
||||
|
Reference in New Issue
Block a user