Package foundry.veil.api
Interface TickTaskScheduler
- All Superinterfaces:
Executor
- All Known Implementing Classes:
TickTaskSchedulerImpl
Schedules tasks to be run on future ticks.
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA single task scheduled to run in the future. -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes the specified command on the next particle system tick.static TickTaskSchedulerget(@Nullable net.minecraft.server.MinecraftServer server) Retrieves the tick task scheduler for the specified server or client.booleanSchedules the specified command to run in the specified number of ticks.<V> TickTaskScheduler.TickTask<V> Schedules the specified command to run in the specified number of ticks.scheduleAtFixedRate(@NotNull Runnable command, long initialDelay, long period) Schedules the specified command to run after the specified initial delay in ticks and at each fixed time interval in ticks.
-
Method Details
-
get
Retrieves the tick task scheduler for the specified server or client.- Parameters:
server- The server to get the scheduler for ornullfor the client scheduler- Returns:
- The scheduler for that server
-
execute
Executes the specified command on the next particle system tick.- Specified by:
executein 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
TickTaskScheduler.TickTask<?> scheduleAtFixedRate(@NotNull @NotNull Runnable command, long initialDelay, long 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
-