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 TypeMethodDescriptionvoid
runAsyncTask
(@NotNull Runnable task) Executes a task on the async scheduler.void
runEntityTask
(@NotNull org.bukkit.entity.Entity entity, @NotNull Runnable task) Executes a task on the entity scheduler.void
scheduleAsyncTask
(@NotNull Runnable task, long delay, @NotNull TimeUnit unit) Schedules a delayed task.void
scheduleRepeatingAsyncTask
(@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
- aRunnable
to run
-
runEntityTask
void runEntityTask(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull Runnable task) Executes a task on the entity scheduler.- Parameters:
entity
- aEntity
to get its schedulertask
- aRunnable
to run
-
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
- aRunnable
to runinterval
- an intervalcondition
- aBooleanSupplier
that decides the task should be continued
-