mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Add a count for chunks we're currently trying to load to not skip chunks at the end of a queue's edit
This commit is contained in:
parent
c8327bfa40
commit
3d0ceb4eb9
@ -74,12 +74,13 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
private final Consumer<Throwable> throwableConsumer;
|
private final Consumer<Throwable> throwableConsumer;
|
||||||
private final boolean unloadAfter;
|
private final boolean unloadAfter;
|
||||||
private final int totalSize;
|
private final int totalSize;
|
||||||
|
|
||||||
private final AtomicInteger expectedSize;
|
private final AtomicInteger expectedSize;
|
||||||
|
|
||||||
private int batchSize;
|
private int batchSize;
|
||||||
private PlotSquaredTask task;
|
private PlotSquaredTask task;
|
||||||
private boolean shouldCancel;
|
private boolean shouldCancel;
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
private int loadingChunks = 0;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BukkitChunkCoordinator(
|
private BukkitChunkCoordinator(
|
||||||
@ -151,7 +152,7 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
Chunk chunk = this.availableChunks.poll();
|
Chunk chunk = this.availableChunks.poll();
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
if (this.availableChunks.isEmpty()) {
|
if (this.availableChunks.isEmpty()) {
|
||||||
if (this.requestedChunks.isEmpty()) {
|
if (this.requestedChunks.isEmpty() && loadingChunks == 0) {
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
requestBatch();
|
requestBatch();
|
||||||
@ -204,9 +205,11 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
BlockVector2 chunk;
|
BlockVector2 chunk;
|
||||||
for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) {
|
for (int i = 0; i < this.batchSize && (chunk = this.requestedChunks.poll()) != null; i++) {
|
||||||
// This required PaperLib to be bumped to version 1.0.4 to mark the request as urgent
|
// This required PaperLib to be bumped to version 1.0.4 to mark the request as urgent
|
||||||
|
loadingChunks++;
|
||||||
PaperLib
|
PaperLib
|
||||||
.getChunkAtAsync(this.bukkitWorld, chunk.getX(), chunk.getZ(), true, true)
|
.getChunkAtAsync(this.bukkitWorld, chunk.getX(), chunk.getZ(), true, true)
|
||||||
.whenComplete((chunkObject, throwable) -> {
|
.whenComplete((chunkObject, throwable) -> {
|
||||||
|
loadingChunks--;
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
// We want one less because this couldn't be processed
|
// We want one less because this couldn't be processed
|
||||||
|
Loading…
Reference in New Issue
Block a user