mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-25 00:25:27 +02:00
Fix ms to ticks conversion on Paper
This commit is contained in:
@@ -36,12 +36,14 @@ import javax.annotation.Nonnegative;
|
|||||||
*/
|
*/
|
||||||
public final class PaperTimeConverter implements TaskTime.TimeConverter {
|
public final class PaperTimeConverter implements TaskTime.TimeConverter {
|
||||||
|
|
||||||
|
private static final long MIN_MS_PER_TICKS = 50L;
|
||||||
|
|
||||||
@Override public long msToTicks(@Nonnegative final long ms) {
|
@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) {
|
@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())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user