Package ch.njol.skript.util
Class Timespan
java.lang.Object
ch.njol.skript.util.Timespan
- All Implemented Interfaces:
YggdrasilSerializable
,Comparable<Timespan>
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.yggdrasil.YggdrasilSerializable
YggdrasilSerializable.YggdrasilExtendedSerializable, YggdrasilSerializable.YggdrasilRobustEnum, YggdrasilSerializable.YggdrasilRobustSerializable
-
Constructor Summary
ConstructorDescriptionTimespan()
Timespan
(long millis) Builds a Timespan from the given milliseconds.Timespan
(Timespan.TimePeriod timePeriod, long time) Builds a Timespan from the given long parameter of a specificTimespan.TimePeriod
. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare this Timespan with anotherboolean
static Timespan
fromTicks
(long ticks) Deprecated.static Timespan
fromTicks_i
(long ticks) Deprecated.UsefromTicks(long)
instead.long
getAs
(Timespan.TimePeriod timePeriod) long
Deprecated.long
getTicks()
Deprecated.long
Deprecated.Use getTicks() instead.int
hashCode()
static @Nullable Timespan
toString()
toString
(int flags) static String
toString
(long millis) static String
toString
(long millis, int flags)
-
Constructor Details
-
Timespan
public Timespan() -
Timespan
public Timespan(long millis) Builds a Timespan from the given milliseconds.- Parameters:
millis
- The milliseconds of Timespan
-
Timespan
Builds a Timespan from the given long parameter of a specificTimespan.TimePeriod
.- Parameters:
timePeriod
- The requested TimePeriodtime
- The time of the requested TimePeriod
-
-
Method Details
-
parse
-
fromTicks
Deprecated.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.UsefromTicks(long)
instead. Old API naming changes. -
getMilliSeconds
Deprecated.- Returns:
- the amount of milliseconds this timespan represents.
-
getTicks
Deprecated.- Returns:
- the amount of Minecraft ticks this timespan represents.
-
getAs
- Returns:
- the amount of TimePeriod this timespan represents.
-
getTicks_i
Deprecated.Use getTicks() instead. Old API naming changes. -
toString
-
toString
-
toString
-
toString
-
compareTo
Compare this Timespan with another- Specified by:
compareTo
in interfaceComparable<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() -
equals
-
Timespan(TimePeriod, long)