From 95eebbac727db509d294f035e454285c315eefa3 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 26 May 2011 22:15:27 +0100 Subject: [PATCH] Fixed a bunch of multiworld issues (entity tracking etc) By: Dinnerbone --- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 7 ++++--- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 7d0a9fc41c..18f86c7034 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -287,7 +287,7 @@ public final class CraftServer implements Server { } // See if the server can process this command - return console.consoleCommandHandler.handle(new ServerCommand(commandLine, new ServerCommandListener(sender))); + return console.consoleCommandHandler.handle(new ServerCommand(commandLine, (ICommandListener)new ServerCommandListener(sender))); } public void reload() { @@ -366,10 +366,11 @@ public final class CraftServer implements Server { converter.convert(name, new ConvertProgressUpdater(console)); } - WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment.getId(), seed); + int dimension = environment.getId() + 200 + console.worlds.size(); + WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, dimension, seed); internal.z = console.worlds.get(0).z; - internal.tracker = new EntityTracker(console, environment.getId()); + internal.tracker = new EntityTracker(console, dimension); internal.addIWorldAccess((IWorldAccess)new WorldManager(console, internal)); internal.spawnMonsters = 1; internal.setSpawnFlags(true, true); 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 371b9ee4ba..ce9d1a19e4 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 @@ -173,11 +173,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (oldWorld != newWorld) { entity.dimension = newWorld.dimension; - entity.netServerHandler.sendPacket(new Packet9Respawn((byte) entity.dimension)); + entity.netServerHandler.sendPacket(new Packet9Respawn((byte) location.getWorld().getEnvironment().getId())); oldWorld.removeEntity(entity); entity.dead = false; + entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); if (entity.Q()) { + oldWorld.entityJoinedWorld(entity, false); newWorld.addEntity(entity); entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); newWorld.entityJoinedWorld(entity, false);