Optimized Island async scan

This commit is contained in:
Fabrizio La Rosa 2020-06-22 05:48:58 +02:00
parent 30e4637d3f
commit 60eb216b2b

View File

@ -186,11 +186,11 @@ public final class IslandScan extends BukkitRunnable {
chunks.getChunksToScan(island, world, paper); chunks.getChunksToScan(island, world, paper);
if(paper){ if(paper){
List<Chunk> positions = new LinkedList<>(); List<ChunkSnapshot> positions = new LinkedList<>();
for(CompletableFuture<Chunk> chunk : chunks.asyncPositions){ for(CompletableFuture<Chunk> chunk : chunks.asyncPositions){
positions.add(chunk.join()); positions.add(chunk.join().getChunkSnapshot());
snapshots.put(skyblock.getWorldManager().getWorld(world), positions.stream().map(org.bukkit.Chunk::getChunkSnapshot).collect(Collectors.toList()));
} }
snapshots.put(skyblock.getWorldManager().getWorld(world), positions);
} else { } else {
snapshots.put(skyblock.getWorldManager().getWorld(world), chunks.syncPositions.stream().map(org.bukkit.Chunk::getChunkSnapshot).collect(Collectors.toList())); snapshots.put(skyblock.getWorldManager().getWorld(world), chunks.syncPositions.stream().map(org.bukkit.Chunk::getChunkSnapshot).collect(Collectors.toList()));
} }