public interface GlobalSchedulerImplementation
| Modifier and Type | Method and Description |
|---|---|
void |
cancelTasks()
Cancels all scheduled global tasks that were scheduled using your
Plugin instance. |
void |
execute(@NotNull java.lang.Runnable run)
Schedules a task to be run.
|
default @NotNull TaskImplementation<java.lang.Void> |
run(@NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer)
Schedules a task to be run after a delay.
|
<T> @NotNull TaskImplementation<T> |
run(@NotNull java.util.function.Function<TaskImplementation<T>,T> function)
Schedules a task to be run after a delay.
|
default @NotNull TaskImplementation<java.lang.Void> |
run(@NotNull java.lang.Runnable runnable)
Schedules a task to be run after a delay.
|
default @NotNull TaskImplementation<java.lang.Void> |
runAtFixedRate(@NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer,
long delay,
long period)
Schedules a task to be run after a delay.
|
<T> @NotNull TaskImplementation<T> |
runAtFixedRate(@NotNull java.util.function.Function<TaskImplementation<T>,T> function,
long delay,
long period)
Schedules a task to be run after a delay.
|
default @NotNull TaskImplementation<java.lang.Void> |
runAtFixedRate(@NotNull java.lang.Runnable runnable,
long delay,
long period)
Schedules a task to be run after a delay.
|
default @NotNull TaskImplementation<java.lang.Void> |
runDelayed(@NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer,
long delay)
Schedules a task to be run after a delay.
|
<T> @NotNull TaskImplementation<T> |
runDelayed(@NotNull java.util.function.Function<TaskImplementation<T>,T> function,
long delay)
Schedules a task to be run after a delay.
|
default @NotNull TaskImplementation<java.lang.Void> |
runDelayed(@NotNull java.lang.Runnable runnable,
long delay)
Schedules a task to be run after a delay.
|
void execute(@NotNull
@NotNull java.lang.Runnable run)
run - The task to run.@NotNull <T> @NotNull TaskImplementation<T> run(@NotNull @NotNull java.util.function.Function<TaskImplementation<T>,T> function)
function - The task to run.@NotNull default @NotNull TaskImplementation<java.lang.Void> run(@NotNull @NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer)
consumer - The task to run.@NotNull default @NotNull TaskImplementation<java.lang.Void> run(@NotNull @NotNull java.lang.Runnable runnable)
runnable - The task to run.@NotNull <T> @NotNull TaskImplementation<T> runDelayed(@NotNull @NotNull java.util.function.Function<TaskImplementation<T>,T> function, long delay)
function - The task to run.delay - The delay in ticks before the task is run.@NotNull default @NotNull TaskImplementation<java.lang.Void> runDelayed(@NotNull @NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer, long delay)
consumer - The task to run.delay - The delay in ticks before the task is run.@NotNull default @NotNull TaskImplementation<java.lang.Void> runDelayed(@NotNull @NotNull java.lang.Runnable runnable, long delay)
runnable - The task to run.delay - The delay in ticks before the task is run.@NotNull <T> @NotNull TaskImplementation<T> runAtFixedRate(@NotNull @NotNull java.util.function.Function<TaskImplementation<T>,T> function, long delay, long period)
function - The task to run.delay - The delay before the task is run.period - The time unit of the delay.@NotNull default @NotNull TaskImplementation<java.lang.Void> runAtFixedRate(@NotNull @NotNull java.util.function.Consumer<TaskImplementation<java.lang.Void>> consumer, long delay, long period)
consumer - The task to run.delay - The delay before the task is run.period - The time unit of the delay.@NotNull default @NotNull TaskImplementation<java.lang.Void> runAtFixedRate(@NotNull @NotNull java.lang.Runnable runnable, long delay, long period)
runnable - The task to run.delay - The delay before the task is run.period - The time unit of the delay.void cancelTasks()
Plugin instance.
Note that the behavior of this method changes depending on the server implementation. For example, in Spigot, this method will cancel all tasks (sync + async) scheduled by the plugin, while in Paper/Folia, this method will only cancel tasks scheduled using the global scheduler.