Fixed a bunch of multiworld issues (entity tracking etc)

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2011-05-26 22:15:27 +01:00
parent 7cf235f516
commit 95eebbac72
2 changed files with 7 additions and 4 deletions

View file

@ -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);

View file

@ -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);