public interface Scheduler
Tasks.| Modifier and Type | Method and Description |
|---|---|
SpongeExecutorService |
createAsyncExecutor(Object plugin)
Creates a new
ExecutorService that can be used to schedule
asynchronous tasks through the standard Java concurrency interfaces. |
SpongeExecutorService |
createSyncExecutor(Object plugin)
Creates a new
ExecutorService that can be used to schedule
synchronous tasks through the standard Java concurrency interfaces. |
Task.Builder |
createTaskBuilder()
Gets a new instance of a
Task.Builder. |
int |
getPreferredTickInterval()
Gets the ideal delay between ticks in milliseconds.
|
Set<Task> |
getScheduledTasks()
Returns a set of all currently scheduled tasks.
|
Set<Task> |
getScheduledTasks(boolean async)
Returns a set of all currently scheduled tasks for either asynchronous or
synchronous execution.
|
Set<Task> |
getScheduledTasks(Object plugin)
Returns a set of all currently scheduled tasks owned by the given plugin.
|
Optional<Task> |
getTaskById(UUID id)
Retrieves a scheduled or running task by its unique ID.
|
Set<Task> |
getTasksByName(String pattern)
Returns a set of
Tasks that match the Regular Expression pattern. |
Task.Builder createTaskBuilder()
Task.Builder.Optional<Task> getTaskById(UUID id)
id - The id of the taskOptional.empty()Set<Task> getTasksByName(String pattern)
Tasks that match the Regular Expression pattern.pattern - The regular expression pattern applied to the name of
tasksTasks that have names that match the pattern,
the set will be empty if no names matchSet<Task> getScheduledTasks()
Set<Task> getScheduledTasks(boolean async)
async - True to get all async tasks, false to get all sync tasksSet<Task> getScheduledTasks(Object plugin)
plugin - The plugin that created the tasksint getPreferredTickInterval()
SpongeExecutorService createSyncExecutor(Object plugin)
ExecutorService that can be used to schedule
synchronous tasks through the standard Java concurrency interfaces.plugin - The plugin that will own the created tasksSpongeExecutorService createAsyncExecutor(Object plugin)
ExecutorService that can be used to schedule
asynchronous tasks through the standard Java concurrency interfaces.plugin - The plugin that will own the created tasksTask.Builder.async()