Package-level declarations

Types

Link copied to clipboard

Facade of a coroutine session of a single extension or entire server.

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 extension: <Error class: unknown class>?, val exception: Throwable)

A Minestom 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.

Properties

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

Gets the extension async dispatcher.

val <Error class: unknown class>.asyncDispatcher: CoroutineContext

Gets the server async dispatcher.

Link copied to clipboard
val <Error class: unknown class>.mcCoroutineConfiguration: MCCoroutineConfiguration
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 extension minecraft dispatcher.

val <Error class: unknown class>.minecraftDispatcher: CoroutineContext

Gets the server minecraft dispatcher.

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

Gets the extension 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 MineStomScheduler 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 <E> <Error class: unknown class><in E>.addSuspendingListener(    extension: <Error class: unknown class>,     eventType: Class<E>,     listener: suspend (E) -> Unit)
fun <E> <Error class: unknown class><in E>.addSuspendingListener(    server: <Error class: unknown class>,     eventType: Class<E>,     listener: suspend (E) -> Unit)

Adds a new suspendable listener to this event node.

Link copied to clipboard
suspend fun <T, R> <Error class: unknown class><T>.asyncSuspend(f: (T) -> R): R

Resolves the object (e.g. Entity) hidden inside the Acquirable object without blocking. Acquirable are resolved immediately if already reserved for the current thread or resolved on a different thread and the function is executed on it. You should only read/write the currently resolved object in the callback parameter. Do not do anything like accessing fields or methods, do that outside of the callback parameter. If you want to edit multiple Acquirable objects at once, put it into a collection e.g. List, Set, etc. and use Collection#asyncSuspend.

suspend fun <T, R> Collection<<Error class: unknown class><T>>.asyncSuspend(f: (Collection<T>) -> R): R

Resolves the objects (e.g. Entities) hidden inside the Acquirable object without blocking. Acquirable are resolved immediately if already reserved for the current thread or resolved on a different thread and the function is executed on it. You should only read/write the currently resolved object in the callback parameter. Do not do anything like accessing fields or methods, do that outside of the callback parameter.

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>
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>.setSuspendingDefaultExecutor(    extension: <Error class: unknown class>,     executor: suspend (<Error class: unknown class>, <Error class: unknown class>) -> Unit)
fun <Error class: unknown class>.setSuspendingDefaultExecutor(    server: <Error class: unknown class>,     executor: suspend (<Error class: unknown class>, <Error class: unknown class>) -> Unit)

Sets the default {@link CommandExecutor}.

Link copied to clipboard
fun <E> <Error class: unknown class><E>.suspendingHandler(    extension: <Error class: unknown class>,     listener: suspend (E) -> Unit): <Error class: unknown class><E>
fun <E> <Error class: unknown class><E>.suspendingHandler(    server: <Error class: unknown class>,     listener: suspend (E) -> Unit): <Error class: unknown class><E>

Adds a new suspendable handler to this builder.