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 883708f5f..53fd535c2 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 @@ -37,11 +37,11 @@ import javax.annotation.Nonnegative; public final class PaperTimeConverter implements TaskTime.TimeConverter { @Override public long msToTicks(@Nonnegative final long ms) { - return (long) (ms / Bukkit.getAverageTickTime()); + return Math.max(1L, (long) (ms / Bukkit.getAverageTickTime())); } @Override public long ticksToMs(@Nonnegative final long ticks) { - return (long) (ticks * Bukkit.getAverageTickTime()); + return Math.max(1L, (long) (ticks * Bukkit.getAverageTickTime())); } } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/SpigotTimeConverter.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/SpigotTimeConverter.java index 86c9673d8..1605e7b77 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/SpigotTimeConverter.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/task/SpigotTimeConverter.java @@ -37,11 +37,11 @@ public final class SpigotTimeConverter implements TaskTime.TimeConverter { private static final long MS_PER_TICKS = 50L; @Override public long msToTicks(@Nonnegative final long ms) { - return ms / MS_PER_TICKS; + return Math.max(1L, ms / MS_PER_TICKS); } @Override public long ticksToMs(@Nonnegative final long ticks) { - return ticks * MS_PER_TICKS; + return Math.max(1L, ticks * MS_PER_TICKS); } } diff --git a/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java b/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java index 9a120e297..7be015532 100644 --- a/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java @@ -96,7 +96,7 @@ public abstract class TaskManager { * @return Task if stored, or {@code null} */ @Nullable public static PlotSquaredTask removeTask(final int id) { - return tasks.get(id); + return tasks.remove(id); } /**