diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/Tick.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/Tick.java index daec951..2c7384a 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/Tick.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/Tick.java @@ -1,5 +1,7 @@ package fr.pandacube.lib.util; +import java.time.Duration; + /** * Provides methods related to Minecraft Java server ticks. */ @@ -44,4 +46,14 @@ public class Tick { return tick * MS_PER_TICK; } + + /** + * Returns the {@link Duration} for the provided number of ticks. + * @param tick the duration in ticks + * @return the {@link Duration} for the provided number of ticks. + */ + public static Duration toDuration(long tick) { + return Duration.ofMillis(toMs(tick)); + } + }