Package net.storm.api.commons
Interface ITime
-
public interface ITime
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_POLLING_RATE
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
sleep(int min, int max)
Sleeps for a random amount of time between a given range.boolean
sleep(long ms)
Sleep will not execute on the client thread, as this may hang the client.default boolean
sleepTick()
Sleeps for one game tick.boolean
sleepTicks(int ticks)
Sleeps for given amount of ticks.boolean
sleepTicksUntil(java.util.function.BooleanSupplier supplier, int ticks)
Sleeps for given amount of ticks, or until given condition is true.default boolean
sleepUntil(java.util.function.BooleanSupplier supplier, int timeOut)
Sleeps until the given condition is true.default boolean
sleepUntil(java.util.function.BooleanSupplier supplier, int pollingRate, int timeOut)
Sleeps until the given condition is true.default boolean
sleepUntil(java.util.function.BooleanSupplier supplier, java.util.function.BooleanSupplier resetSupplier, int timeOut)
Sleeps until the given condition is true.boolean
sleepUntil(java.util.function.BooleanSupplier supplier, java.util.function.BooleanSupplier resetSupplier, int pollingRate, int timeOut)
Sleeps until the given condition is true.
-
-
-
Field Detail
-
DEFAULT_POLLING_RATE
static final int DEFAULT_POLLING_RATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
sleep
boolean sleep(long ms)
Sleep will not execute on the client thread, as this may hang the client.- Parameters:
ms
- The amount of milliseconds to sleep.- Returns:
- Whether the sleep call was successful.
-
sleep
boolean sleep(int min, int max)
Sleeps for a random amount of time between a given range. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
min
- The minimum amount of milliseconds to sleep.max
- The maximum amount of milliseconds to sleep.- Returns:
- Whether the sleep call was successful.
-
sleepUntil
boolean sleepUntil(java.util.function.BooleanSupplier supplier, java.util.function.BooleanSupplier resetSupplier, int pollingRate, int timeOut)
Sleeps until the given condition is true. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
supplier
- The completion condition.resetSupplier
- The condition to reset the sleep timer.pollingRate
- The amount of time to check whether the given conditions are true.timeOut
- The amount of time until a timeout.- Returns:
- Whether the sleep call was successful.
-
sleepUntil
default boolean sleepUntil(java.util.function.BooleanSupplier supplier, java.util.function.BooleanSupplier resetSupplier, int timeOut)
Sleeps until the given condition is true. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
supplier
- The completion condition.resetSupplier
- The condition to reset the sleep timer.timeOut
- The amount of time until a timeout.- Returns:
- Whether the sleep call was successful.
-
sleepUntil
default boolean sleepUntil(java.util.function.BooleanSupplier supplier, int pollingRate, int timeOut)
Sleeps until the given condition is true. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
supplier
- The completion condition.pollingRate
- The amount of time to check whether the given conditions are true.timeOut
- The amount of time until a timeout.- Returns:
- Whether the sleep call was successful.
-
sleepUntil
default boolean sleepUntil(java.util.function.BooleanSupplier supplier, int timeOut)
Sleeps until the given condition is true. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
supplier
- The completion condition.timeOut
- The amount of time until a timeout.- Returns:
- Whether the sleep call was successful.
-
sleepTicks
boolean sleepTicks(int ticks)
Sleeps for given amount of ticks. Sleep will not execute on the client thread, as this may hang the client.- Parameters:
ticks
- Amount of time to sleep in ticks.- Returns:
- Whether the sleep call was successful.
-
sleepTick
default boolean sleepTick()
Sleeps for one game tick. Sleep will not execute on the client thread, as this may hang the client.- Returns:
- Whether the sleep call was successful.
-
sleepTicksUntil
boolean sleepTicksUntil(java.util.function.BooleanSupplier supplier, int ticks)
Sleeps for given amount of ticks, or until given condition is true.- Parameters:
supplier
- The break condition.ticks
- Max. amount of ticks to sleep.- Returns:
- Whether the sleep call was successful.
-
-