mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
plugin disabler
This commit is contained in:
parent
c42250072b
commit
90fc27d612
@ -1,7 +1,7 @@
|
|||||||
# style guide
|
# style guide
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
# config
|
# config
|
||||||
miraiVersion=0.28.0
|
miraiVersion=0.29.0
|
||||||
miraiConsoleVersion=0.3.4
|
miraiConsoleVersion=0.3.4
|
||||||
miraiConsoleWrapperVersion=0.1.3
|
miraiConsoleWrapperVersion=0.1.3
|
||||||
kotlin.incremental.multiplatform=true
|
kotlin.incremental.multiplatform=true
|
||||||
|
@ -195,7 +195,6 @@ internal object MiraiConsoleLogger {
|
|||||||
if (e != null) {
|
if (e != null) {
|
||||||
MiraiConsole.frontEnd.pushLog(LogPriority.INFO, identityStr, identity, e.stackTrace.joinToString("\n"))
|
MiraiConsole.frontEnd.pushLog(LogPriority.INFO, identityStr, identity, e.stackTrace.joinToString("\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,13 @@ object CommandManager : Job by {
|
|||||||
}
|
}
|
||||||
}() {
|
}() {
|
||||||
private val registeredCommand: MutableMap<String, Command> = mutableMapOf()
|
private val registeredCommand: MutableMap<String, Command> = mutableMapOf()
|
||||||
|
|
||||||
val commands: Collection<Command> get() = registeredCommand.values
|
val commands: Collection<Command> get() = registeredCommand.values
|
||||||
|
|
||||||
|
fun reload(){
|
||||||
|
registeredCommand.clear()
|
||||||
|
DefaultCommands()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册这个指令.
|
* 注册这个指令.
|
||||||
*
|
*
|
||||||
|
@ -14,7 +14,9 @@ package net.mamoe.mirai.console.plugins
|
|||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import net.mamoe.mirai.console.MiraiConsole
|
import net.mamoe.mirai.console.MiraiConsole
|
||||||
import net.mamoe.mirai.console.command.Command
|
import net.mamoe.mirai.console.command.Command
|
||||||
|
import net.mamoe.mirai.console.command.CommandManager
|
||||||
import net.mamoe.mirai.console.command.CommandSender
|
import net.mamoe.mirai.console.command.CommandSender
|
||||||
|
import net.mamoe.mirai.console.command.DefaultCommands
|
||||||
import net.mamoe.mirai.utils.SimpleLogger
|
import net.mamoe.mirai.utils.SimpleLogger
|
||||||
import net.mamoe.mirai.utils.io.encodeToString
|
import net.mamoe.mirai.utils.io.encodeToString
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -236,6 +238,9 @@ object PluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请注意 这个方法不会移除该指令已注册的指令
|
||||||
|
*/
|
||||||
fun disablePlugin(
|
fun disablePlugin(
|
||||||
plugin:PluginBase,
|
plugin:PluginBase,
|
||||||
exception: CancellationException? = null
|
exception: CancellationException? = null
|
||||||
@ -253,6 +258,7 @@ object PluginManager {
|
|||||||
}
|
}
|
||||||
nameToPluginBaseMap.clear()
|
nameToPluginBaseMap.clear()
|
||||||
pluginDescriptions.clear()
|
pluginDescriptions.clear()
|
||||||
|
CommandManager.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user