Package net.okocraft.box.api.scheduler
Interface BoxScheduler
public interface BoxScheduler
An interface to schedule tasks.
This interface does not have some scheduling methods like delaying or repeating.
-
Method Summary
Modifier and TypeMethodDescriptionvoidrunAsyncTask(@NotNull Runnable task) Executes a task on the async scheduler.voidrunEntityTask(@NotNull Entity entity, @NotNull Runnable task) Executes a task on the entity scheduler.voidscheduleAsyncTask(@NotNull Runnable task, long delay, @NotNull TimeUnit unit) Schedules a delayed task.voidscheduleRepeatingAsyncTask(@NotNull Runnable task, @NotNull Duration interval, @NotNull BooleanSupplier condition) Schedules a repeating task.
-
Method Details
-
runAsyncTask
Executes a task on the async scheduler.- Parameters:
task- aRunnableto run
-
runEntityTask
Executes a task on the entity scheduler. -
scheduleAsyncTask
void scheduleAsyncTask(@NotNull @NotNull Runnable task, long delay, @NotNull @NotNull TimeUnit unit) Schedules a delayed task. -
scheduleRepeatingAsyncTask
void scheduleRepeatingAsyncTask(@NotNull @NotNull Runnable task, @NotNull @NotNull Duration interval, @NotNull @NotNull BooleanSupplier condition) Schedules a repeating task.- Parameters:
task- aRunnableto runinterval- an intervalcondition- aBooleanSupplierthat decides the task should be continued
-