Scheduler

class Scheduler(plugin: Plugin)

Wrapper for the Bukkit scheduler.

This class provides a simplified API for scheduling tasks on the Bukkit main thread or asynchronously. It also automatically tracks tasks for lifecycle management.

Constructors

Link copied to clipboard
constructor(plugin: Plugin)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun async(task: () -> Unit): TaskHandle

Runs the task asynchronously.

Link copied to clipboard
fun later(delay: Ticks, task: () -> Unit): TaskHandle

Runs the task after the specified delay.

Link copied to clipboard
fun launch(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> Unit): TaskHandle

Launches a coroutine on the Bukkit main thread.

Link copied to clipboard
fun launchAsync(context: CoroutineContext = EmptyCoroutineContext, block: suspend CoroutineScope.() -> Unit): TaskHandle

Launches a coroutine asynchronously.

Link copied to clipboard
fun sync(task: () -> Unit): TaskHandle

Runs the task on the next tick (synchronously on the main thread).

Link copied to clipboard
fun timer(delay: Ticks, period: Ticks, task: () -> Unit): TaskHandle

Runs the task repeatedly with the specified delay and period.

Link copied to clipboard
fun timerAsync(delay: Ticks, period: Ticks, task: () -> Unit): TaskHandle

Runs the task repeatedly and asynchronously with the specified delay and period.