Remove chunks from queue if we don't need them anymore.

This commit is contained in:
Travis Watkins
2014-02-11 20:48:50 -06:00
committed by EvilSeph
parent f6f0cf338a
commit afb3511a4a
2 changed files with 45 additions and 10 deletions

View File

@@ -20,6 +20,11 @@ public class ChunkIOExecutor {
instance.add(new QueuedChunk(x, z, loader, world, provider), runnable);
}
// Abuses the fact that hashCode and equals for QueuedChunk only use world and coords
public static void dropQueuedChunkLoad(World world, int x, int z, Runnable runnable) {
instance.drop(new QueuedChunk(x, z, null, world, null), runnable);
}
public static void adjustPoolSize(int players) {
int size = Math.max(BASE_THREADS, (int) Math.ceil(players / PLAYERS_PER_THREAD));
instance.setActiveThreads(size);