fully disable plugin

This commit is contained in:
jiahua.liu 2020-03-22 19:54:28 +08:00
parent 975ca6bb2b
commit 3b6530a406

View File

@ -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 => 没找到