fix ArrayOutOfBounds when selecting 1 chunk

This commit is contained in:
YouHaveTrouble
2021-07-26 21:45:22 +02:00
parent d79caba543
commit 97da78d1ef
2 changed files with 3 additions and 2 deletions
@@ -33,7 +33,7 @@ public class ReplaceOperation {
task.cancel();
return;
}
for (int i = 0; i<= chunksPerTick; i++) {
for (int i = 0; i< chunksPerTick; i++) {
processChunkWork(chunkwork.get(element.getAndDecrement()), bePlayer.getSelectionWorld());
}
}, 0, 1);
@@ -24,6 +24,7 @@ public class SetOperation {
this.selection = bePlayer.getSelection();
this.blockToSet = blockToSet;
this.chunkwork.addAll(chunkWorks);
AtomicInteger element = new AtomicInteger(chunkwork.size()-1);
Bukkit.getScheduler().runTaskTimer(BlockEdit.getPlugin(), (task) -> {
@@ -31,7 +32,7 @@ public class SetOperation {
task.cancel();
return;
}
for (int i = 0; i<= chunksPerTick; i++) {
for (int i = 0; i< chunksPerTick; i++) {
processChunkWork(chunkwork.get(element.getAndDecrement()), bePlayer.getSelectionWorld());
}
}, 0, 1);