mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Cleanup
This commit is contained in:
parent
98224cfe5e
commit
d496df3deb
@ -27,18 +27,9 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by Coroutine
|
||||
@JvmField
|
||||
internal val registeredCommands: MutableList<Command> = mutableListOf()
|
||||
|
||||
/**
|
||||
* 全部注册的指令
|
||||
* /mute -> MuteCommand
|
||||
* /jinyan -> MuteCommand
|
||||
*/
|
||||
@JvmField
|
||||
internal val requiredPrefixCommandMap: MutableMap<String, Command> = mutableMapOf()
|
||||
|
||||
/**
|
||||
* Command name of commands that are prefix optional
|
||||
* mute -> MuteCommand
|
||||
*/
|
||||
@JvmField
|
||||
internal val optionalPrefixCommandMap: MutableMap<String, Command> = mutableMapOf()
|
||||
|
||||
@ -57,8 +48,7 @@ internal object CommandManagerImpl : CommandManager, CoroutineScope by Coroutine
|
||||
}
|
||||
|
||||
internal val commandListener: Listener<MessageEvent> by lazy {
|
||||
@Suppress("RemoveExplicitTypeArguments")
|
||||
subscribeAlways<MessageEvent>(
|
||||
subscribeAlways(
|
||||
concurrency = Listener.ConcurrencyKind.CONCURRENT,
|
||||
priority = Listener.EventPriority.HIGH
|
||||
) {
|
||||
|
@ -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 = {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user