Skip to content

Scheduler

zNotChill edited this page Sep 13, 2025 · 2 revisions

Blossom reimplements Minestom's scheduler system in a very basic way.

The run block provides you with the TaskManager parameter, allowing you to manage the task from inside the task.

The custom task function is available under SchedulerManager.task.

Tasks are automatically ran upon building.

Example Server-wide Task

MinecraftServer.getSchedulerManager().task {
    repeat = 10.ticks
    run = { task ->
        if (MinecraftServer.getConnectionManager().onlinePlayers.isNotEmpty()) {
            task.cancel() // or .stop()
            println("too many players! canceling task!")
        } else {
            println("running task")
        }
    }
}

Clone this wiki locally