taskLaunch

fun Player.taskLaunch(plugin: Plugin, block: suspend CoroutineScope.() -> Unit): TaskHandle

Launches a coroutine on the Bukkit main thread and tracks it for this Player.

The coroutine will be automatically cancelled when the player quits the server.

Return

a TaskHandle that can be used to cancel the coroutine

Parameters

plugin

the Plugin instance to schedule the task under

block

the coroutine code


fun World.taskLaunch(plugin: Plugin, block: suspend CoroutineScope.() -> Unit): TaskHandle

Launches a coroutine on the Bukkit main thread and tracks it for this World.

The coroutine will be automatically cancelled when the world is unloaded.

Return

a TaskHandle that can be used to cancel the coroutine

Parameters

plugin

the Plugin instance to schedule the task under

block

the coroutine code