diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-08-04 22:12:16 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-08-04 22:12:16 -0500 |
commit | 0e013fa4b088eee3e99526e1a2b10b9fcb385838 (patch) | |
tree | 0ecc61de9cc1c9fe9ec43b7375f7508086fd3272 /src | |
parent | 9804665fec34c375c9f66cd756a96de9d57ed505 (diff) | |
download | craftbukkit-0e013fa4b088eee3e99526e1a2b10b9fcb385838.tar craftbukkit-0e013fa4b088eee3e99526e1a2b10b9fcb385838.tar.gz craftbukkit-0e013fa4b088eee3e99526e1a2b10b9fcb385838.tar.lz craftbukkit-0e013fa4b088eee3e99526e1a2b10b9fcb385838.tar.xz craftbukkit-0e013fa4b088eee3e99526e1a2b10b9fcb385838.zip |
Fixed PlayerManager ConcurrentModificationExceptions. Fixes BUKKIT-1972
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerManager.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index 0f4e678e..5409ba77 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -4,12 +4,14 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Queue; // CraftBukkit + public class PlayerManager { private final WorldServer world; private final List managedPlayers = new ArrayList(); private final LongHashMap c = new LongHashMap(); - private final List d = new ArrayList(); + private final Queue d = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue private final int e; private final int[][] f = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}}; private boolean wasNotEmpty; // CraftBukkit @@ -36,9 +38,11 @@ public class PlayerManager { PlayerInstance playerinstance = (PlayerInstance) iterator.next(); playerinstance.a(); + + iterator.remove(); // CraftBukkit - remove to insure we are the consumer } - this.d.clear(); + // this.d.clear(); // CraftBukkit - removals are already covered if (this.managedPlayers.isEmpty()) { if (!wasNotEmpty) return; // CraftBukkit - only do unload when we go from non-empty to empty WorldProvider worldprovider = this.world.worldProvider; @@ -231,7 +235,7 @@ public class PlayerManager { return playermanager.c; } - static List c(PlayerManager playermanager) { + static Queue c(PlayerManager playermanager) { // CraftBukkit List -> Queue return playermanager.d; } } |