More controlled chunk existence checking.

This commit is contained in:
Harrison Deng 2020-05-04 23:20:54 -05:00
parent 10022876d5
commit 9d77fe3bb6
2 changed files with 1 additions and 16 deletions

View File

@ -4,12 +4,8 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang.NullArgumentException;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.generator.ChunkGenerator;
import ca.recrown.islandsurvivalcraft.world.generation.GeneratorModes;
@ -60,14 +56,6 @@ public class WorldInfoManager implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onChunkLoaded(ChunkLoadEvent event) {
if (event.isNewChunk()) {
Chunk chunk = event.getChunk();
retrieve(event.getWorld()).getGenerator().updateChunkLoadedCache(chunk.getX(), chunk.getZ());
}
}
protected void register(World world, WorldInfo worldInfo) {
worldInformation.put(world.getUID(), worldInfo);
}

View File

@ -146,6 +146,7 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
e.printStackTrace();
throw new IllegalStateException(e.getCause().getMessage());
}
chunkLoadedCache.set(new Point2(chunkX, chunkZ), true);
return chunkData;
}
@ -190,8 +191,4 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
public boolean isParallelCapable() {
return true;
}
public void updateChunkLoadedCache(int chunkX, int chunkZ) {
this.chunkLoadedCache.set(new Point2(chunkX, chunkZ), true);
}
}