mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-18 21:41:45 +01:00
Correct scheduler behaviour with intervals of >= Integer.MAX_VALUE (circa 3 years).
By: md_5 <git@md-5.net>
This commit is contained in:
parent
f4e233550c
commit
6d76725098
@ -60,10 +60,10 @@ public class CraftScheduler implements BukkitScheduler {
|
|||||||
private final PriorityQueue<CraftTask> pending = new PriorityQueue<CraftTask>(10,
|
private final PriorityQueue<CraftTask> pending = new PriorityQueue<CraftTask>(10,
|
||||||
new Comparator<CraftTask>() {
|
new Comparator<CraftTask>() {
|
||||||
public int compare(final CraftTask o1, final CraftTask o2) {
|
public int compare(final CraftTask o1, final CraftTask o2) {
|
||||||
int value = (int) (o1.getNextRun() - o2.getNextRun());
|
int value = Long.compare(o1.getNextRun(), o2.getNextRun());
|
||||||
|
|
||||||
// If the tasks should run on the same tick they should be run FIFO
|
// If the tasks should run on the same tick they should be run FIFO
|
||||||
return value != 0 ? value : o1.getTaskId() - o2.getTaskId();
|
return value != 0 ? value : Integer.compare(o1.getTaskId(), o2.getTaskId());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user