From d35483b0e10b2017382a5fb407ecb889483bafaf Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 25 Jul 2017 15:36:44 +1000 Subject: [PATCH] Correct scheduler behaviour with intervals of >= Integer.MAX_VALUE (circa 3 years). --- .../java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index bdddf0b5fa..edd7c74def 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -60,10 +60,10 @@ public class CraftScheduler implements BukkitScheduler { private final PriorityQueue pending = new PriorityQueue(10, new Comparator() { 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 - return value != 0 ? value : o1.getTaskId() - o2.getTaskId(); + return value != 0 ? value : Integer.compare(o1.getTaskId(), o2.getTaskId()); } }); /**