diff --git a/mirai-core/src/commonMain/kotlin/event/EventChannelImpl.kt b/mirai-core/src/commonMain/kotlin/event/EventChannelImpl.kt index 913d1fa34..6195b318a 100644 --- a/mirai-core/src/commonMain/kotlin/event/EventChannelImpl.kt +++ b/mirai-core/src/commonMain/kotlin/event/EventChannelImpl.kt @@ -37,7 +37,7 @@ internal annotation class DangerousEventChannelImplConstructor internal open class EventChannelImpl @DangerousEventChannelImplConstructor constructor( baseEventClass: KClass, defaultCoroutineContext: CoroutineContext = EmptyCoroutineContext ) : EventChannel(baseEventClass, defaultCoroutineContext) { - val eventListeners = EventListeners() + private val eventListeners = EventListeners() // drop any unsubscribed events private val flow = MutableSharedFlow(extraBufferCapacity = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST) @@ -48,6 +48,7 @@ internal open class EventChannelImpl @DangerousEventChannelImplConstr suspend fun callListeners(event: Event) { event as AbstractEvent + logEvent(event) eventListeners.callListeners(event) flow.emit(event) } @@ -86,10 +87,7 @@ internal open class EventChannelImpl @DangerousEventChannelImplConstr } event.broadCastLock.withLock { event._intercepted = false - @Suppress("DEPRECATION") - if (EventDisabled) return@withLock - logEvent(event) - eventListeners.callListeners(event) + callListeners(event) } return event