Package net.storm.api.commons
Interface ITime
public interface ITime
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleansleep(int min, int max) Sleeps for a random amount of time between a given range.booleansleep(long ms) Sleep will not execute on the client thread, as this may hang the client.default booleanSleeps for one game tick.booleansleepTicks(int ticks) Sleeps for given amount of ticks.booleansleepTicksUntil(BooleanSupplier supplier, int ticks) Sleeps for given amount of ticks, or until given condition is true.default booleansleepUntil(BooleanSupplier supplier, int timeOut) Sleeps until the given condition is true.default booleansleepUntil(BooleanSupplier supplier, int pollingRate, int timeOut) Sleeps until the given condition is true.default booleansleepUntil(BooleanSupplier supplier, BooleanSupplier resetSupplier, int timeOut) Sleeps until the given condition is true.booleansleepUntil(BooleanSupplier supplier, BooleanSupplier resetSupplier, int pollingRate, int timeOut) Sleeps until the given condition is true.
-
Field Details
-
DEFAULT_POLLING_RATE
static final int DEFAULT_POLLING_RATE- See Also:
-
-
Method Details
-
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(BooleanSupplier supplier, 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
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
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
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
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.
-