mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-14 20:30:12 +08:00
fully disable plugin
This commit is contained in:
parent
975ca6bb2b
commit
3b6530a406
@ -232,13 +232,26 @@ object PluginManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun disablePlugin(
|
||||||
|
plugin:PluginBase,
|
||||||
|
exception: CancellationException? = null
|
||||||
|
){
|
||||||
|
nameToPluginBaseMap.remove(plugin.pluginName)
|
||||||
|
pluginDescriptions.remove(plugin.pluginName)
|
||||||
|
plugin.disable(exception)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun disableAllPlugins(throwable: CancellationException? = null) {
|
fun disableAllPlugins(throwable: CancellationException? = null) {
|
||||||
nameToPluginBaseMap.values.forEach {
|
nameToPluginBaseMap.values.forEach {
|
||||||
it.disable(throwable)
|
it.disable(throwable)
|
||||||
}
|
}
|
||||||
|
nameToPluginBaseMap.clear()
|
||||||
|
pluginDescriptions.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据插件名字找Jar的文件
|
* 根据插件名字找Jar的文件
|
||||||
* null => 没找到
|
* null => 没找到
|
||||||
|
Loading…
Reference in New Issue
Block a user