Skip to content

Scheduler

endstone.scheduler

Scheduler

Represents a scheduler that executes various tasks

cancel_task

cancel_task(id: int) -> None

Removes task from scheduler.

cancel_tasks

cancel_tasks(plugin: Plugin) -> None

Removes all tasks associated with a particular plugin from the scheduler.

get_pending_tasks

get_pending_tasks() -> list[Task]

Returns a vector of all pending tasks.

is_queued

is_queued(id: int) -> bool

Check if the task queued to be run later.

is_running

is_running(id: int) -> bool

Check if the task currently running.

run_task

run_task(plugin: Plugin, task: Callable[[], None]) -> Task

Returns a task that will be executed synchronously on the next server tick.

run_task_later

run_task_later(
    plugin: Plugin, task: Callable[[], None], delay: int
) -> Task

Returns a task that will be executed synchronously after the specified number of server ticks.

run_task_timer

run_task_timer(
    plugin: Plugin,
    task: Callable[[], None],
    delay: int,
    period: int,
) -> Task

Returns a task that will be executed repeatedly until cancelled, starting after the specified number of server ticks.

Task

Represents a task being executed by the scheduler

is_cancelled property

is_cancelled: bool

Returns true if the task has been cancelled.

is_sync property

is_sync: bool

Returns true if the task is run by server thread.

owner property

owner: Plugin

Returns the Plugin that owns the task.

task_id property

task_id: int

Returns the task id.

cancel

cancel() -> None

Attempts to cancel this task.