Skip to content

Scheduler

endstone.scheduler

Classes:

Name Description
Scheduler

Represents a scheduler that executes various tasks

Task

Represents a task being executed by the scheduler

Scheduler

Represents a scheduler that executes various tasks

Methods:

Name Description
cancel_task

Removes task from scheduler.

cancel_tasks

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

get_pending_tasks

Returns a vector of all pending tasks.

is_queued

Check if the task queued to be run later.

is_running

Check if the task currently running.

run_task

Returns a task that will be executed synchronously

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],
    delay: int = 0,
    period: int = 0,
) -> Task

Returns a task that will be executed synchronously

Task

Represents a task being executed by the scheduler

Methods:

Name Description
cancel

Attempts to cancel this task.

Attributes:

Name Type Description
is_cancelled bool

Returns true if the task has been cancelled.

is_sync bool

Returns true if the task is run by server thread.

owner Plugin

Returns the Plugin that owns the task.

task_id int

Returns the task id.

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.