Package foundry.veil.api
Interface TickTaskScheduler
- All Superinterfaces:
Executor
- All Known Implementing Classes:
TickTaskSchedulerImpl
Schedules tasks to be run on future ticks.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes the specified command on the next particle system tick.boolean
Schedules the specified command to run in the specified number of ticks.<V> CompletableFuture
<V> Schedules the specified command to run in the specified number of ticks.scheduleAtFixedRate
(@NotNull Runnable command, int initialDelay, int period) Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.
-
Method Details
-
execute
Executes the specified command on the next particle system tick.- Specified by:
execute
in interfaceExecutor
- Parameters:
command
- The runnable task- Throws:
RejectedExecutionException
- if the task cannot be scheduled for executionNullPointerException
- if command is null
-
schedule
Schedules the specified command to run in the specified number of ticks.- Parameters:
command
- The runnable taskdelay
- The delay in ticks- Returns:
- A future that completes after the task has been run
- Throws:
RejectedExecutionException
- if the task cannot be scheduled for executionNullPointerException
- if command is nullIllegalArgumentException
- if delay less than or equal to zero
-
schedule
Schedules the specified command to run in the specified number of ticks.- Parameters:
callable
- The callable taskdelay
- The delay in ticks- Returns:
- A future that completes after the task has been run
- Throws:
RejectedExecutionException
- if the task cannot be scheduled for executionNullPointerException
- if command is nullIllegalArgumentException
- if delay less than or equal to zero
-
scheduleAtFixedRate
CompletableFuture<?> scheduleAtFixedRate(@NotNull @NotNull Runnable command, int initialDelay, int period) Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.- Parameters:
command
- The runnable taskinitialDelay
- The initial delay in ticksperiod
- The period between task executions- Returns:
- A future that completes if there was an error
- Throws:
RejectedExecutionException
- if the task cannot be scheduled for executionNullPointerException
- if command is nullIllegalArgumentException
- if delay less than or equal to zero
-
isShutdown
boolean isShutdown()- Returns:
- Whether the executor has shut down and will reject
-