mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Don't trigger async catcher when adding chunk ticket
- Apparently PaperLib#getChunkAtAsync#whenComplete doesn't necessarily run the task on the main thread
This commit is contained in:
parent
2ab1973668
commit
7a3d5bd737
@ -28,6 +28,7 @@ package com.plotsquared.bukkit.queue;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
import com.plotsquared.bukkit.BukkitPlatform;
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.queue.ChunkCoordinator;
|
import com.plotsquared.core.queue.ChunkCoordinator;
|
||||||
import com.plotsquared.core.queue.subscriber.ProgressSubscriber;
|
import com.plotsquared.core.queue.subscriber.ProgressSubscriber;
|
||||||
import com.plotsquared.core.util.task.PlotSquaredTask;
|
import com.plotsquared.core.util.task.PlotSquaredTask;
|
||||||
@ -36,7 +37,6 @@ import com.plotsquared.core.util.task.TaskTime;
|
|||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -204,8 +204,10 @@ public final class BukkitChunkCoordinator extends ChunkCoordinator {
|
|||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
// We want one less because this couldn't be processed
|
// We want one less because this couldn't be processed
|
||||||
this.expectedSize.decrementAndGet();
|
this.expectedSize.decrementAndGet();
|
||||||
} else {
|
} else if (PlotSquared.get().isMainThread(Thread.currentThread())) {
|
||||||
this.processChunk(chunkObject);
|
this.processChunk(chunkObject);
|
||||||
|
} else {
|
||||||
|
TaskManager.runTask(() -> this.processChunk(chunkObject));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user