Commit defaf83a authored by Him188's avatar Him188

Make `var EventDisabled` visible

parent 35f06b3b
......@@ -79,6 +79,12 @@ suspend fun <E : Event> E.broadcast(): E = apply {
this@broadcast.broadcastInternal() // inline, no extra cost
}
/**
* 设置为 `true` 以关闭事件.
* 所有的 `subscribe` 都能正常添加到监听器列表, 但所有的广播都会直接返回.
*/
var EventDisabled = false
/**
* 可控制是否需要广播这个事件包
*/
......
......@@ -11,6 +11,7 @@ package net.mamoe.mirai.event.internal
import kotlinx.coroutines.*
import net.mamoe.mirai.event.Event
import net.mamoe.mirai.event.EventDisabled
import net.mamoe.mirai.event.Listener
import net.mamoe.mirai.event.ListeningStatus
import net.mamoe.mirai.utils.LockFreeLinkedList
......@@ -22,12 +23,6 @@ import kotlin.coroutines.coroutineContext
import kotlin.jvm.JvmField
import kotlin.reflect.KClass
/**
* 设置为 `true` 以关闭事件.
* 所有的 `subscribe` 都能正常添加到监听器列表, 但所有的广播都会直接返回.
*/
var EventDisabled = false
@PublishedApi
internal fun <L : Listener<E>, E : Event> KClass<out E>.subscribeInternal(listener: L): L {
this.listeners().addLast(listener)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment