Package com.github.shynixn.mccoroutine.velocity

Types

CoroutineSession
Link copied to clipboard
interface CoroutineSession

Facade of a coroutine session of a single plugin.

MCCoroutine
Link copied to clipboard
interface MCCoroutine
MCCoroutineExceptionEvent
Link copied to clipboard
class MCCoroutineExceptionEvent(plugin: <ERROR CLASS>, 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.

SuspendingPluginContainer
Link copied to clipboard
class SuspendingPluginContainer

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.

SuspendingSimpleCommand
Link copied to clipboard
interface SuspendingSimpleCommand : SuspendInvocableCommand<<ERROR CLASS>>

Suspending SimpleCommand.

SuspendInvocableCommand
Link copied to clipboard
interface SuspendInvocableCommand<I>

Functions

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

Allows to register a suspending command.

launch
Link copied to clipboard
fun <ERROR CLASS>.launch(context: CoroutineContext = velocityDispatcher, start: <ERROR CLASS> = CoroutineStart.DEFAULT, block: suspend <ERROR CLASS>.() -> Unit): <ERROR 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.

registerSuspend
Link copied to clipboard
fun <ERROR 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>.registerSuspend(meta: <ERROR CLASS>, command: SuspendingSimpleCommand, plugin: Any)

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

fun <E> <ERROR CLASS>.registerSuspend(plugin: Any, eventClass: Class<E>, handler: suspend (E) -> Unit)
fun <E> <ERROR CLASS>.registerSuspend(plugin: Any, eventClass: Class<E>, postOrder: <ERROR CLASS>, handler: suspend (E) -> Unit)

Registers a new event listener with a functional style listener.

Properties

scope
Link copied to clipboard
val <ERROR CLASS>.scope: <ERROR CLASS>

Gets the plugin coroutine scope.

velocityDispatcher
Link copied to clipboard
val <ERROR CLASS>.velocityDispatcher: CoroutineContext

Gets the plugin velocity dispatcher.