Future is on main thread, so do calcs async

This commit is contained in:
tastybento 2019-11-11 07:37:43 -08:00
parent 0647d28c51
commit aaa88d765b
1 changed files with 8 additions and 7 deletions

View File

@ -83,13 +83,14 @@ public class CalcIslandLevel {
count = 0;
chunksToScan.forEach(c -> {
PaperLib.getChunkAtAsync(world, c.x, c.z).thenAccept(ch -> {
if (ch != null) {
this.scanChunk(ch.getChunkSnapshot());
}
count++;
if (count == chunksToScan.size()) {
this.tidyUp();
}
ChunkSnapshot snapShot = ch.getChunkSnapshot();
Bukkit.getScheduler().runTaskAsynchronously(addon.getPlugin(), () -> {
this.scanChunk(snapShot);
count++;
if (count == chunksToScan.size()) {
this.tidyUp();
}
});
});
});