mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Fix Plugin.description in PluginManager
This commit is contained in:
parent
8a3b0046f9
commit
b5ab460bf8
@ -52,11 +52,14 @@ internal object PluginManagerImpl : PluginManager, CoroutineScope by MiraiConsol
|
|||||||
get() = _pluginLoaders.toList()
|
get() = _pluginLoaders.toList()
|
||||||
|
|
||||||
override val Plugin.description: PluginDescription
|
override val Plugin.description: PluginDescription
|
||||||
get() = resolvedPlugins.firstOrNull { it == this }
|
get() = if (this is JvmPlugin) {
|
||||||
|
this.safeLoader.getDescription(this)
|
||||||
|
} else resolvedPlugins.firstOrNull { it == this }
|
||||||
?.loader?.cast<PluginLoader<Plugin, PluginDescription>>()
|
?.loader?.cast<PluginLoader<Plugin, PluginDescription>>()
|
||||||
?.getDescription(this)
|
?.getDescription(this)
|
||||||
?: error("Plugin is unloaded")
|
?: error("Plugin is unloaded")
|
||||||
|
|
||||||
|
|
||||||
override fun PluginLoader<*, *>.register(): Boolean = loadersLock.withLock {
|
override fun PluginLoader<*, *>.register(): Boolean = loadersLock.withLock {
|
||||||
if (_pluginLoaders.any { it::class == this::class }) {
|
if (_pluginLoaders.any { it::class == this::class }) {
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user