Possibly fixed block/chunk leaking

This commit is contained in:
Dinnerbone 2011-02-06 22:53:48 +00:00
parent 8b14c72a8d
commit 7bdc190637
4 changed files with 24 additions and 14 deletions

View File

@ -9,9 +9,13 @@ public class PlayerManager {
private PlayerList b = new PlayerList();
private List c = new ArrayList();
private MinecraftServer d;
private WorldServer world; // Craftbukkit
public PlayerManager(MinecraftServer minecraftserver) {
// Craftbukkit - change of method signature
public PlayerManager(MinecraftServer minecraftserver, WorldServer world) {
this.d = minecraftserver;
this.world = world; // Craftbukkit
}
public void a() {

View File

@ -28,7 +28,7 @@ public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft");
public List b = new ArrayList();
public MinecraftServer c; // Craftbukkit - public
public PlayerManager d; // Craftbukkit - public
// public PlayerManager d; // Craftbukkit - removed!
private int e;
private Set f = new HashSet();
private Set g = new HashSet();
@ -54,7 +54,7 @@ public class ServerConfigurationManager {
this.i = minecraftserver.a("banned-players.txt");
this.j = minecraftserver.a("banned-ips.txt");
this.k = minecraftserver.a("ops.txt");
this.d = new PlayerManager(minecraftserver);
// this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed!
this.e = minecraftserver.d.a("max-players", 20);
this.e();
this.g();
@ -69,7 +69,7 @@ public class ServerConfigurationManager {
}
public int a() {
return this.d.b();
return 144; // Craftbukkit - magic number from PlayerManager.b() (??)
}
public void a(EntityPlayer entityplayer) {
@ -86,22 +86,22 @@ public class ServerConfigurationManager {
entityplayer.world.a(entityplayer);
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer)));
((WorldServer)entityplayer.world).manager.a(entityplayer);
// Craftbukkit end
this.d.a(entityplayer);
}
public void b(EntityPlayer entityplayer) {
this.d.c(entityplayer);
((WorldServer)entityplayer.world).c(entityplayer); // Craftbukkit
}
public void c(EntityPlayer entityplayer) {
this.l.a(entityplayer);
entityplayer.world.d(entityplayer); // Craftbukkit
this.b.remove(entityplayer);
this.d.b(entityplayer);
// CraftBukkit start
((WorldServer)entityplayer.world).manager.b(entityplayer);
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayer))); // CraftBukkit
// CraftBukkit end
}
@ -150,7 +150,7 @@ public class ServerConfigurationManager {
// Craftbukkit start - every reference to this.c.e should be entityplayer.world
this.c.k.a(entityplayer);
this.c.k.b(entityplayer);
this.d.b(entityplayer);
((WorldServer)entityplayer.world).manager.b(entityplayer);
this.b.remove(entityplayer);
entityplayer.world.e(entityplayer);
EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
@ -177,7 +177,7 @@ public class ServerConfigurationManager {
entityplayer1.a.b((Packet) (new Packet9Respawn()));
entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
this.d.a(entityplayer1);
((WorldServer)entityplayer1.world).manager.a(entityplayer1);
entityplayer.world.a(entityplayer1);
this.b.add(entityplayer1);
entityplayer1.l();
@ -186,12 +186,16 @@ public class ServerConfigurationManager {
}
public void b() {
this.d.a();
// Craftbukkit start
for (WorldServer world : c.worlds) {
world.manager.a();
}
// Craftbukkit end
}
// Craftbukkit - changed signature
public void a(int i, int j, int k, WorldServer world) {
this.d.a(i, j, k, world); // Craftbukkit
world.manager.a(i, j, k, world); // Craftbukkit
}
public void a(Packet packet) {

View File

@ -22,6 +22,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
public boolean C;
private MinecraftServer D;
private EntityList E = new EntityList();
public PlayerManager manager; // Craftbukkit
public WorldServer(MinecraftServer minecraftserver, File file1, String s, int i) {
super(file1, s, (new Random()).nextLong(), WorldProvider.a(i));
@ -30,6 +31,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
// CraftBukkit start
world = new CraftWorld(this);
server = minecraftserver.server;
manager = new PlayerManager(minecraftserver, this);
}
private final CraftWorld world;

View File

@ -123,7 +123,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (oldWorld != newWorld) {
manager.c.k.a(entity);
manager.c.k.b(entity);
manager.d.b(entity);
oldWorld.manager.b(entity);
manager.b.remove(entity);
oldWorld.e(entity);
@ -136,7 +136,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
manager.d.a(newEntity);
newWorld.manager.a(newEntity);
newWorld.a(newEntity);
manager.b.add(newEntity);
newEntity.l();