Class Ticks

java.lang.Object
dev.demeng.pluginbase.scheduler.Ticks

public final class Ticks extends Object
Utility for converting between Minecraft game ticks and standard durations.
  • Field Details

  • Constructor Details

    • Ticks

      public Ticks()
  • Method Details

    • from

      public static long from(long duration, @NotNull @NotNull TimeUnit unit)
      Converts a duration in a certain unit of time to ticks.

      Ticks.from(duration) returns the number of ticks from the given duration.

      Parameters:
      duration - the duration of time
      unit - the unit the duration is in
      Returns:
      the number of ticks which represent the duration
    • to

      public static long to(long ticks, @NotNull @NotNull TimeUnit unit)
      Converts ticks to a duration in a certain unit of time.

      Ticks.to(ticks) converts the number of ticks to a duration.

      Parameters:
      ticks - the number of ticks
      unit - the unit to return the duration in
      Returns:
      a duration value in the given unit, representing the number of ticks