Make all event implementations internal

This commit is contained in:
Him188 2020-04-02 13:20:16 +08:00
parent 38748e0c10
commit 997261fa3b
2 changed files with 4 additions and 6 deletions

View File

@ -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 {

View File

@ -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,