diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-06 22:53:48 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-07 01:51:06 +0000 |
commit | 7bdc190637081a8f46c404b556bafc5eccf4903f (patch) | |
tree | cf717466ea5531097daebd40cb8562ba61ca56ca /src | |
parent | 8b14c72a8d3537aae52aac69693489a1e9fe5559 (diff) | |
download | craftbukkit-7bdc190637081a8f46c404b556bafc5eccf4903f.tar craftbukkit-7bdc190637081a8f46c404b556bafc5eccf4903f.tar.gz craftbukkit-7bdc190637081a8f46c404b556bafc5eccf4903f.tar.lz craftbukkit-7bdc190637081a8f46c404b556bafc5eccf4903f.tar.xz craftbukkit-7bdc190637081a8f46c404b556bafc5eccf4903f.zip |
Possibly fixed block/chunk leaking
Diffstat (limited to 'src')
4 files changed, 24 insertions, 14 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index 3837635b..51dca1b4 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -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() { diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 1532f97c..dfb86e48 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -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) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 0e43967a..8a18621d 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -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; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 4b42c04f..920244d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -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(); |