From 997261fa3b185170071489543df09dcab024d330 Mon Sep 17 00:00:00 2001 From: Him188 <Him188@mamoe.net> Date: Thu, 2 Apr 2020 13:20:16 +0800 Subject: [PATCH] Make all event implementations internal --- .../event/internal/InternalEventListeners.kt | 4 ++-- .../net/mamoe/mirai/event/internal/EventInternalJvm.kt | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt index 3b1034336..d7eca4ad0 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt @@ -25,8 +25,8 @@ import kotlin.coroutines.coroutineContext import kotlin.jvm.JvmField import kotlin.reflect.KClass -@MiraiInternalAPI -fun <L : Listener<E>, E : Event> KClass<out E>.subscribeInternal(listener: L): L { +@PublishedApi +internal fun <L : Listener<E>, E : Event> KClass<out E>.subscribeInternal(listener: L): L { with(this.listeners()) { addLast(listener) listener.invokeOnCompletion { diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt index 5fe4131de..d2f3a979c 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt @@ -22,9 +22,8 @@ import java.util.function.Consumer import java.util.function.Function import kotlin.coroutines.EmptyCoroutineContext -@MiraiInternalAPI @Suppress("FunctionName") -fun <E : Event> Class<E>._subscribeEventForJaptOnly( +internal fun <E : Event> Class<E>._subscribeEventForJaptOnly( scope: CoroutineScope, onEvent: Function<E, ListeningStatus> ): Listener<E> { @@ -35,9 +34,8 @@ fun <E : Event> Class<E>._subscribeEventForJaptOnly( ) { withContext(Dispatchers.IO) { onEvent.apply(it) } }) } -@MiraiInternalAPI @Suppress("FunctionName") -fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineScope, onEvent: Consumer<E>): Listener<E> { +internal fun <E : Event> Class<E>._subscribeEventForJaptOnly(scope: CoroutineScope, onEvent: Consumer<E>): Listener<E> { return this.kotlin.subscribeInternal( scope.Handler( EmptyCoroutineContext,