Package-level declarations

Types

Link copied to clipboard

Facade of a coroutine session of a single plugin.

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

A Velocity 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

When injecting this class into your plugin instance, a new coroutine session is booted. Calling initialize allows to listen to suspend events in your plugin main class.

Link copied to clipboard
interface SuspendingSimpleCommand : SuspendInvocableCommand<<Error class: unknown class>>

Suspending SimpleCommand.

Link copied to clipboard

Properties

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

Gets the plugin coroutine scope.

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

Gets the plugin velocity dispatcher.

Functions

Link copied to clipboard
fun <S, T> <Error class: unknown class><S, T>.executesSuspend(plugin: Any, command: suspend (<Error class: unknown class><S>) -> Int): T

Allows to register a suspending command.

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

Launches a new coroutine on the Velocity Plugin ThreadPool 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>.registerSuspend(plugin: Any, listener: Any)

Registers an event listener with suspending functions. Does exactly the same thing as server.getEventManager().register but makes suspension functions possible. Example:

fun <Error class: unknown class>.registerSuspend(meta: <Error class: unknown class>, command: SuspendingSimpleCommand, plugin: Any)

Registers an command executor with suspending function. Does exactly the same as CommandManager.register

fun <E> <Error class: unknown class>.registerSuspend(plugin: Any, eventClass: Class<E>, handler: suspend (handler: E) -> Unit)
fun <E> <Error class: unknown class>.registerSuspend(    plugin: Any,     eventClass: Class<E>,     postOrder: <Error class: unknown class>,     handler: suspend (handler: E) -> Unit)

Registers a new event listener with a functional style listener.