9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-24 09:29:19 +00:00

Fix possible error

This commit is contained in:
XiaoMoMi
2024-09-19 14:16:16 +08:00
parent 6966022619
commit 8c41e266d0
2 changed files with 2 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ public class WorldScheduler {
thread.setName("customcrops-world-scheduler");
return thread;
});
this.scheduler.setMaximumPoolSize(1);
this.scheduler.setRemoveOnCancelPolicy(true);
this.scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
this.worker = new ForkJoinPool(PARALLELISM, new WorkerThreadFactory(), new ExceptionHandler(), false);

View File

@@ -128,6 +128,7 @@ public abstract class AbstractWorldAdaptor<W> implements WorldAdaptor<W> {
}
private int[] queueToIntArray(PriorityQueue<DelayedTickTask> queue) {
queue.removeIf(Objects::isNull);
int size = queue.size() * 2;
int[] tasks = new int[size];
int i = 0;