geforkt von Mirrors/Paper
Fixed a bunch of multiworld issues (entity tracking etc)
Dieser Commit ist enthalten in:
Ursprung
036f49ddbf
Commit
1784e42d5f
@ -51,7 +51,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public int spawnProtection;
|
public int spawnProtection;
|
||||||
public List<WorldServer> worlds = new ArrayList<WorldServer>(); // TODO - REPLACE ABOVE
|
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||||
public CraftServer server;
|
public CraftServer server;
|
||||||
public OptionSet options;
|
public OptionSet options;
|
||||||
public ColouredConsoleSender console;
|
public ColouredConsoleSender console;
|
||||||
@ -461,7 +461,15 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WorldServer a(int i) {
|
public WorldServer a(int i) {
|
||||||
return i == -1 ? this.worlds.get(1) : this.worlds.get(0); // Craftbukkit
|
// Craftbukkit start
|
||||||
|
for (WorldServer world : worlds) {
|
||||||
|
if (world.dimension == i) {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return worlds.get(0);
|
||||||
|
// Craftbukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityTracker b(int i) {
|
public EntityTracker b(int i) {
|
||||||
|
@ -29,7 +29,7 @@ public class ServerConfigurationManager {
|
|||||||
public static Logger a = Logger.getLogger("Minecraft");
|
public static Logger a = Logger.getLogger("Minecraft");
|
||||||
public List players = new ArrayList();
|
public List players = new ArrayList();
|
||||||
public MinecraftServer server; // CraftBukkit - private -> public
|
public MinecraftServer server; // CraftBukkit - private -> public
|
||||||
private PlayerManager[] d = new PlayerManager[2];
|
// private PlayerManager[] d = new PlayerManager[2]; // Craftbukkit - removed
|
||||||
public int maxPlayers; // CraftBukkit - private -> public
|
public int maxPlayers; // CraftBukkit - private -> public
|
||||||
private Set banByName = new HashSet();
|
private Set banByName = new HashSet();
|
||||||
private Set banByIP = new HashSet();
|
private Set banByIP = new HashSet();
|
||||||
@ -58,8 +58,7 @@ public class ServerConfigurationManager {
|
|||||||
this.m = minecraftserver.a("white-list.txt");
|
this.m = minecraftserver.a("white-list.txt");
|
||||||
int i = minecraftserver.propertyManager.getInt("view-distance", 10);
|
int i = minecraftserver.propertyManager.getInt("view-distance", 10);
|
||||||
|
|
||||||
this.d[0] = new PlayerManager(minecraftserver, 0, i);
|
// Craftbukkit - removed playermanagers
|
||||||
this.d[1] = new PlayerManager(minecraftserver, -1, i);
|
|
||||||
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
|
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
|
||||||
this.o = minecraftserver.propertyManager.getBoolean("white-list", false);
|
this.o = minecraftserver.propertyManager.getBoolean("white-list", false);
|
||||||
this.g();
|
this.g();
|
||||||
@ -78,8 +77,7 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(EntityPlayer entityplayer) {
|
public void a(EntityPlayer entityplayer) {
|
||||||
this.d[0].removePlayer(entityplayer);
|
// Craftbukkit - removed playermanagers
|
||||||
this.d[1].removePlayer(entityplayer);
|
|
||||||
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
||||||
WorldServer worldserver = this.server.a(entityplayer.dimension);
|
WorldServer worldserver = this.server.a(entityplayer.dimension);
|
||||||
|
|
||||||
@ -87,11 +85,17 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int a() {
|
public int a() {
|
||||||
return this.d[0].c();
|
// Craftbukkit start
|
||||||
|
if (this.server.worlds.size() == 0) {
|
||||||
|
return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
|
||||||
|
} else {
|
||||||
|
return this.server.worlds.get(0).manager.c();
|
||||||
|
}
|
||||||
|
// Craftbukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerManager a(int i) {
|
private PlayerManager a(int i) {
|
||||||
return i == -1 ? this.d[1] : this.d[0];
|
return server.a(i).manager; // Craftbukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(EntityPlayer entityplayer) {
|
public void b(EntityPlayer entityplayer) {
|
||||||
@ -241,7 +245,7 @@ public class ServerConfigurationManager {
|
|||||||
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) entityplayer1.dimension));
|
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) ((WorldServer)entityplayer1.world).getWorld().getEnvironment().getId()));
|
||||||
entityplayer1.netServerHandler.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
|
entityplayer1.netServerHandler.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
|
||||||
this.a(entityplayer1, worldserver);
|
this.a(entityplayer1, worldserver);
|
||||||
this.a(entityplayer1.dimension).addPlayer(entityplayer1);
|
this.a(entityplayer1.dimension).addPlayer(entityplayer1);
|
||||||
@ -266,7 +270,8 @@ public class ServerConfigurationManager {
|
|||||||
entityplayer.dimension = b0;
|
entityplayer.dimension = b0;
|
||||||
WorldServer worldserver1 = this.server.a(entityplayer.dimension);
|
WorldServer worldserver1 = this.server.a(entityplayer.dimension);
|
||||||
|
|
||||||
entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) entityplayer.dimension));
|
// Craftbukkit
|
||||||
|
entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) ((WorldServer)entityplayer.world).getWorld().getEnvironment().getId()));
|
||||||
worldserver.removeEntity(entityplayer);
|
worldserver.removeEntity(entityplayer);
|
||||||
entityplayer.dead = false;
|
entityplayer.dead = false;
|
||||||
double d0 = entityplayer.locX;
|
double d0 = entityplayer.locX;
|
||||||
@ -306,9 +311,11 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void b() {
|
public void b() {
|
||||||
for (int i = 0; i < this.d.length; ++i) {
|
// Craftbukkit start
|
||||||
this.d[i].flush();
|
for (int i = 0; i < this.server.worlds.size(); ++i) {
|
||||||
|
this.server.worlds.get(i).manager.flush();
|
||||||
}
|
}
|
||||||
|
// Craftbukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flagDirty(int i, int j, int k, int l) {
|
public void flagDirty(int i, int j, int k, int l) {
|
||||||
|
@ -27,12 +27,14 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||||||
this.cserver = minecraftserver.server;
|
this.cserver = minecraftserver.server;
|
||||||
this.world = new CraftWorld(this);
|
this.world = new CraftWorld(this);
|
||||||
this.pvpMode = minecraftserver.pvpMode;
|
this.pvpMode = minecraftserver.pvpMode;
|
||||||
|
this.manager = new PlayerManager(minecraftserver, dimension, minecraftserver.propertyManager.getInt("view-distance", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int dimension;
|
public final int dimension;
|
||||||
private final CraftWorld world;
|
private final CraftWorld world;
|
||||||
private final CraftServer cserver;
|
private final CraftServer cserver;
|
||||||
public EntityTracker tracker;
|
public EntityTracker tracker;
|
||||||
|
public PlayerManager manager;
|
||||||
|
|
||||||
public CraftWorld getWorld() {
|
public CraftWorld getWorld() {
|
||||||
return world;
|
return world;
|
||||||
|
@ -287,7 +287,7 @@ public final class CraftServer implements Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if the server can process this command
|
// 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() {
|
public void reload() {
|
||||||
@ -366,10 +366,11 @@ public final class CraftServer implements Server {
|
|||||||
converter.convert(name, new ConvertProgressUpdater(console));
|
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.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.addIWorldAccess((IWorldAccess)new WorldManager(console, internal));
|
||||||
internal.spawnMonsters = 1;
|
internal.spawnMonsters = 1;
|
||||||
internal.setSpawnFlags(true, true);
|
internal.setSpawnFlags(true, true);
|
||||||
|
@ -173,11 +173,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
if (oldWorld != newWorld) {
|
if (oldWorld != newWorld) {
|
||||||
entity.dimension = newWorld.dimension;
|
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);
|
oldWorld.removeEntity(entity);
|
||||||
entity.dead = false;
|
entity.dead = false;
|
||||||
|
|
||||||
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
if (entity.Q()) {
|
if (entity.Q()) {
|
||||||
|
oldWorld.entityJoinedWorld(entity, false);
|
||||||
newWorld.addEntity(entity);
|
newWorld.addEntity(entity);
|
||||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
newWorld.entityJoinedWorld(entity, false);
|
newWorld.entityJoinedWorld(entity, false);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren