Class Timespan

java.lang.Object
ch.njol.skript.util.Timespan
All Implemented Interfaces:
YggdrasilSerializable, Comparable<Timespan>

public class Timespan extends Object implements YggdrasilSerializable, Comparable<Timespan>
  • Constructor Details

    • Timespan

      public Timespan()
    • Timespan

      public Timespan(long millis)
      Builds a Timespan from the given milliseconds.
      Parameters:
      millis - The milliseconds of Timespan
    • Timespan

      public Timespan(Timespan.TimePeriod timePeriod, long time)
      Builds a Timespan from the given long parameter of a specific Timespan.TimePeriod.
      Parameters:
      timePeriod - The requested TimePeriod
      time - The time of the requested TimePeriod
  • Method Details

    • parse

      @Nullable public static @Nullable Timespan parse(String value)
    • fromTicks

      @Deprecated @ScheduledForRemoval public static Timespan fromTicks(long ticks)
      Builds a Timespan from the given long parameter.
      Parameters:
      ticks - The amount of Minecraft ticks to convert to a timespan.
      Returns:
      Timespan based on the provided long.
    • fromTicks_i

      @Deprecated @ScheduledForRemoval public static Timespan fromTicks_i(long ticks)
      Deprecated.
      Use fromTicks(long) instead. Old API naming changes.
    • getMilliSeconds

      @Deprecated @ScheduledForRemoval public long getMilliSeconds()
      Deprecated.
      Returns:
      the amount of milliseconds this timespan represents.
    • getTicks

      @Deprecated @ScheduledForRemoval public long getTicks()
      Deprecated.
      Returns:
      the amount of Minecraft ticks this timespan represents.
    • getAs

      public long getAs(Timespan.TimePeriod timePeriod)
      Returns:
      the amount of TimePeriod this timespan represents.
    • getTicks_i

      @Deprecated @ScheduledForRemoval public long getTicks_i()
      Deprecated.
      Use getTicks() instead. Old API naming changes.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int flags)
    • toString

      public static String toString(long millis)
    • toString

      public static String toString(long millis, int flags)
    • compareTo

      public int compareTo(@Nullable @Nullable Timespan time)
      Compare this Timespan with another
      Specified by:
      compareTo in interface Comparable<Timespan>
      Parameters:
      time - the Timespan to be compared.
      Returns:
      -1 if this Timespan is less than argument Timespan, 0 if equals and 1 if greater than
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object