diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Event.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Event.kt index 7686a8f8b..23075cfa4 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Event.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/Event.kt @@ -2,6 +2,9 @@ package net.mamoe.mirai.event +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import net.mamoe.mirai.event.internal.broadcastInternal /** @@ -50,4 +53,6 @@ interface Cancellable { */ @Synchronized @Suppress("UNCHECKED_CAST") -suspend fun E.broadcast(): E = this.broadcastInternal() \ No newline at end of file +suspend fun E.broadcast(): E = withContext(EventScope.coroutineContext) { this@broadcast.broadcastInternal() } + +object EventScope : CoroutineScope by CoroutineScope(Dispatchers.Default)//todo may change \ No newline at end of file