Package com.github.shynixn.mccoroutine.minestom

Types

CoroutineSession
Link copied to clipboard
interface CoroutineSession

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

MCCoroutine
Link copied to clipboard
interface MCCoroutine

Hidden internal MCCoroutine interface.

MCCoroutineConfiguration
Link copied to clipboard
interface MCCoroutineConfiguration

Additional configurations for MCCoroutine and communication.

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

ShutdownStrategy
Link copied to clipboard
enum ShutdownStrategy : Enum<ShutdownStrategy>

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

Functions

addSuspendingListener
Link copied to clipboard
fun <E> <ERROR CLASS><in E>.addSuspendingListener(extension: <ERROR CLASS>, eventType: Class<E>, listener: suspend (E) -> Unit)
fun <E> <ERROR CLASS><in E>.addSuspendingListener(server: <ERROR CLASS>, eventType: Class<E>, listener: suspend (E) -> Unit)

Adds a new suspendable listener to this event node.

asyncSuspend
Link copied to clipboard
suspend fun <T, R> <ERROR 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><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.

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

setSuspendingDefaultExecutor
Link copied to clipboard
fun <ERROR CLASS>.setSuspendingDefaultExecutor(extension: <ERROR CLASS>, executor: suspend (<ERROR CLASS>, <ERROR CLASS>) -> Unit)
fun <ERROR CLASS>.setSuspendingDefaultExecutor(server: <ERROR CLASS>, executor: suspend (<ERROR CLASS>, <ERROR CLASS>) -> Unit)

Sets the default {@link CommandExecutor}.

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

Adds a new suspendable handler to this builder.

Properties

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

Gets the extension async dispatcher.

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

Gets the server async dispatcher.

mcCoroutineConfiguration
Link copied to clipboard
val <ERROR CLASS>.mcCoroutineConfiguration: MCCoroutineConfiguration

Gets the configuration instance of MCCoroutine.

mcCoroutineConfiguration
Link copied to clipboard
val <ERROR CLASS>.mcCoroutineConfiguration: MCCoroutineConfiguration

Gets the configuration instance of MCCoroutine.

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

Gets the extension minecraft dispatcher.

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

Gets the server minecraft dispatcher.

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

Gets the extension coroutine scope.

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

Gets the extension coroutine scope.

ticks
Link copied to clipboard
val Int.ticks: Long

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.