Package-level declarations

Types

Link copied to clipboard

Facade of a coroutine session of a single plugin.

Link copied to clipboard

The spigot timings require a reference to the runnable to display the name of timings correctly. Now, Kotlin Coroutines does not allow to directly pass a runnable object, because a single coroutine may consist out of multiple runnables. This class is a workaround coroutine context element, which can be passed along the minecraftDispatcher to display a valid name for the coroutine.

Link copied to clipboard

The mode how suspendable events are executed if dispatched manually.

Link copied to clipboard
interface MCCoroutine

Hidden internal MCCoroutine interface.

Link copied to clipboard

Additional configurations for MCCoroutine and communication.

Link copied to clipboard
class MCCoroutineExceptionEvent(val plugin: <Error class: unknown class>, val exception: Throwable)

A Bukkit event which is called when an exception is raised in one of the coroutines managed by MCCoroutine. Cancelling this exception causes the error to not get logged and offers to possibility for custom logging.

Link copied to clipboard

See https://shynixn.github.io/MCCoroutine/wiki/site/plugindisable for more details.

Link copied to clipboard

Represents a class which contains a single method for executing commands

Link copied to clipboard

Extension to the JavaPlugin for suspendable lifecycle functions.

Link copied to clipboard

Extension to the plugin interface for suspendable lifecycle functions.

Link copied to clipboard

Represents a suspending class which can suggest tab completions for commands.

Properties

Link copied to clipboard
val <Error class: unknown class>.asyncDispatcher: CoroutineContext

Gets the plugin async dispatcher.

Link copied to clipboard
val <Error class: unknown class>.mcCoroutineConfiguration: MCCoroutineConfiguration

Gets the configuration instance of MCCoroutine.

Link copied to clipboard
val <Error class: unknown class>.minecraftDispatcher: CoroutineContext

Gets the plugin minecraft dispatcher.

Link copied to clipboard
val <Error class: unknown class>.scope: <Error class: unknown class>

Gets the plugin coroutine scope.

Link copied to clipboard

Converts the number to ticks for being used together with delay(..). E.g. delay(1.ticks). Minecraft ticks 20 times per second, which means a tick appears every 50 milliseconds. However, delay() does not directly work with the BukkitScheduler and needs millisecond manipulation to work as expected. Therefore, 1 tick does not equal 50 milliseconds when using this method standalone and only sums up to 50 milliseconds if you use it together with delay.

Functions

Link copied to clipboard
fun <Error class: unknown class>.callSuspendingEvent(    event: <Error class: unknown class>,     plugin: <Error class: unknown class>): Collection<<Error class: unknown class>>

Calls an event with the given details. If there are multiple suspend event receivers, each receiver is executed concurrently. Allows to await the completion of suspending event listeners.

fun <Error class: unknown class>.callSuspendingEvent(    event: <Error class: unknown class>,     plugin: <Error class: unknown class>,     eventExecutionType: EventExecutionType): Collection<<Error class: unknown class>>

Calls an event with the given details. Allows to await the completion of suspending event listeners.

Link copied to clipboard
fun <Error class: unknown class>.launch(    context: CoroutineContext = minecraftDispatcher,     start: <Error class: unknown class> = CoroutineStart.DEFAULT,     block: suspend <Error class: unknown class>.() -> Unit): <Error class: unknown class>

Launches a new coroutine on the minecraft main thread without blocking the current thread and returns a reference to the coroutine as a Job. The coroutine is cancelled when the resulting job is Job.cancel.

Link copied to clipboard
fun <Error class: unknown class>.registerSuspendingEvents(listener: <Error class: unknown class>, plugin: <Error class: unknown class>)

Registers an event listener with suspending functions. Does exactly the same thing as PluginManager.registerEvents but makes suspend functions possible. Example:

Link copied to clipboard
fun <Error class: unknown class>.setSuspendingExecutor(suspendingCommandExecutor: SuspendingCommandExecutor)
fun <Error class: unknown class>.setSuspendingExecutor(context: CoroutineContext, suspendingCommandExecutor: SuspendingCommandExecutor)

Registers a command executor with suspending function. Does exactly the same as PluginCommand.setExecutor.

Link copied to clipboard
fun <Error class: unknown class>.setSuspendingTabCompleter(suspendingTabCompleter: SuspendingTabCompleter)
fun <Error class: unknown class>.setSuspendingTabCompleter(context: CoroutineContext, suspendingTabCompleter: SuspendingTabCompleter)

Registers a tab completer with suspending function. Does exactly the same as PluginCommand.setExecutor.