diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandManagerImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandManagerImpl.kt index dc7d7433d..6b01b2c81 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandManagerImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/CommandManagerImpl.kt @@ -27,18 +27,9 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by Coroutine @JvmField internal val registeredCommands: MutableList = mutableListOf() - /** - * 全部注册的指令 - * /mute -> MuteCommand - * /jinyan -> MuteCommand - */ @JvmField internal val requiredPrefixCommandMap: MutableMap = mutableMapOf() - /** - * Command name of commands that are prefix optional - * mute -> MuteCommand - */ @JvmField internal val optionalPrefixCommandMap: MutableMap = mutableMapOf() @@ -57,8 +48,7 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by Coroutine } internal val commandListener: Listener by lazy { - @Suppress("RemoveExplicitTypeArguments") - subscribeAlways( + subscribeAlways( concurrency = Listener.ConcurrencyKind.CONCURRENT, priority = Listener.EventPriority.HIGH ) { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/AutoSavePluginData.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/AutoSavePluginData.kt index 6a80cd3d4..8037b167a 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/AutoSavePluginData.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/data/AutoSavePluginData.kt @@ -1,7 +1,10 @@ package net.mamoe.mirai.console.internal.data import kotlinx.atomicfu.atomic -import kotlinx.coroutines.* +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import net.mamoe.mirai.console.data.* import net.mamoe.mirai.console.internal.plugin.updateWhen import net.mamoe.mirai.console.util.ConsoleInternalAPI @@ -35,8 +38,7 @@ internal open class AutoSavePluginData( internal var currentFirstStartTime = atomic(0L) init { - @OptIn(InternalCoroutinesApi::class) - owner.coroutineContext[Job]?.invokeOnCompletion(true) { doSave() } + owner.coroutineContext[Job]?.invokeOnCompletion { doSave() } } private val updaterBlock: suspend CoroutineScope.() -> Unit = { diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/PluginManagerImpl.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/PluginManagerImpl.kt index 3ee5d44f3..f2994b475 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/PluginManagerImpl.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/plugin/PluginManagerImpl.kt @@ -12,7 +12,6 @@ package net.mamoe.mirai.console.internal.plugin import kotlinx.atomicfu.locks.withLock -import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.Job import net.mamoe.mirai.console.MiraiConsole import net.mamoe.mirai.console.internal.data.cast @@ -58,8 +57,7 @@ internal object PluginManagerImpl : PluginManager { } init { - @OptIn(InternalCoroutinesApi::class) - MiraiConsole.coroutineContext[Job]!!.invokeOnCompletion(true) { + MiraiConsole.coroutineContext[Job]!!.invokeOnCompletion { plugins.forEach(Plugin::disable) } }