Change ChunkletManager to a notify/demand system

Allowing NullChunkletManager to bypass the ChunkletUnloader as it is not needed.
This commit is contained in:
NuclearW
2012-07-07 14:42:35 -04:00
parent 646bb32965
commit f7a5678814
5 changed files with 97 additions and 22 deletions

View File

@ -6,6 +6,7 @@ import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Chunk;
import org.bukkit.World;
import com.gmail.nossr50.mcMMO;
@ -26,6 +27,10 @@ public class ChunkletUnloader implements Runnable {
unloadedChunks.put(chunk, 0);
}
public static void addToList(int cx, int cz, World world) {
addToList(world.getChunkAt(cx, cz));
}
@Override
public void run() {
for (Iterator<Entry<Chunk, Integer>> it = unloadedChunks.entrySet().iterator() ; it.hasNext() ; ) {
@ -37,7 +42,7 @@ public class ChunkletUnloader implements Runnable {
//Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime
if (inactiveTime >= minimumInactiveTime) {
mcMMO.placeStore.chunkUnloaded(chunk.getX(), chunk.getZ(), chunk.getWorld());
mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld());
it.remove();
continue;
}