BukkitMainThreadDispatcher

class BukkitMainThreadDispatcher(plugin: Plugin, tickRate: Long) : CoroutineDispatcher, Runnable, Delay(source)

A CoroutineDispatcher that runs on the Bukkit main thread. As it is tied to the server's tick loop (internally converting all "milliseconds" to "ticks"), execution speed is determined by the server's tick rate. This means that if the server's TPS is 10, and a coroutine delays for 1000 milliseconds, it will actually delay for at least 2000 milliseconds, as the server is running at half speed.

Parameters

plugin

The plugin instance to use for scheduling tasks. If the plugin is disabled, the dispatcher will not execute any tasks.

tickRate

The tick rate to use for scheduling tasks. This determines how often the dispatcher checks for tasks to execute. Measured in ticks.

Constructors

Link copied to clipboard
constructor(plugin: Plugin, tickRate: Long)

Properties

Link copied to clipboard
open override val key: CoroutineContext.Key<*>

Functions

Link copied to clipboard

Creates a CoroutineContext for a child coroutine, with a Job that is a child of the current context's Job

Link copied to clipboard
open suspend fun delay(time: Long)
Link copied to clipboard
open override fun dispatch(context: CoroutineContext, block: Runnable)
Link copied to clipboard
@InternalCoroutinesApi
open fun dispatchYield(context: CoroutineContext, block: Runnable)
Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
override fun <T> interceptContinuation(continuation: Continuation<T>): Continuation<T>
Link copied to clipboard
open fun invokeOnTimeout(timeMillis: Long, block: Runnable, context: CoroutineContext): DisposableHandle
Link copied to clipboard
open override fun isDispatchNeeded(context: CoroutineContext): Boolean
Link copied to clipboard
open fun limitedParallelism(parallelism: Int, name: String?): CoroutineDispatcher
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext
operator fun plus(other: CoroutineDispatcher): CoroutineDispatcher
Link copied to clipboard
override fun releaseInterceptedContinuation(continuation: Continuation<*>)
Link copied to clipboard
open override fun run()
Link copied to clipboard
open override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation<Unit>)
Link copied to clipboard
open override fun toString(): String