Cleanup our iterators.

This commit is contained in:
gmcferrin
2013-01-09 22:18:41 -05:00
parent 6cc2fc7a6e
commit 75a5ffcb10
6 changed files with 12 additions and 31 deletions

View File

@ -33,8 +33,8 @@ public class ChunkletUnloader implements Runnable {
@Override
public void run() {
for (Iterator<Entry<Chunk, Integer>> it = unloadedChunks.entrySet().iterator() ; it.hasNext() ; ) {
Entry<Chunk, Integer> entry = it.next();
for (Iterator<Entry<Chunk, Integer>> unloadedChunkIterator = unloadedChunks.entrySet().iterator() ; unloadedChunkIterator.hasNext() ; ) {
Entry<Chunk, Integer> entry = unloadedChunkIterator.next();
Chunk chunk = entry.getKey();
if (!chunk.isLoaded()) {
@ -46,7 +46,7 @@ public class ChunkletUnloader implements Runnable {
continue;
mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld());
it.remove();
unloadedChunkIterator.remove();
continue;
}
@ -54,7 +54,7 @@ public class ChunkletUnloader implements Runnable {
}
else {
//Just remove the entry if the chunk has been reloaded.
it.remove();
unloadedChunkIterator.remove();
}
}
}