From 47d9895077726374871346f63c8de6d8c531a4a6 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Mon, 17 Aug 2020 16:37:27 +0200 Subject: [PATCH] Fix ms to ticks conversion on Paper --- .../plotsquared/bukkit/util/task/PaperTimeConverter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/PaperTimeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/PaperTimeConverter.java index 1a39bb95e..c5bfb44cf 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/PaperTimeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/PaperTimeConverter.java @@ -36,12 +36,14 @@ import javax.annotation.Nonnegative; */ public final class PaperTimeConverter implements TaskTime.TimeConverter { + private static final long MIN_MS_PER_TICKS = 50L; + @Override public long msToTicks(@Nonnegative final long ms) { - return Math.max(1L, (long) (ms / Bukkit.getAverageTickTime())); + return Math.max(1L, (long) (ms / Math.max(MIN_MS_PER_TICKS, Bukkit.getAverageTickTime()))); } @Override public long ticksToMs(@Nonnegative final long ticks) { - return Math.max(1L, (long) (ticks * Bukkit.getAverageTickTime())); + return Math.max(1L, (long) (ticks * Math.max(MIN_MS_PER_TICKS, Bukkit.getAverageTickTime()))); } }