mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40: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()
|
||||
|
||||
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>>()
|
||||
?.getDescription(this)
|
||||
?: error("Plugin is unloaded")
|
||||
|
||||
|
||||
override fun PluginLoader<*, *>.register(): Boolean = loadersLock.withLock {
|
||||
if (_pluginLoaders.any { it::class == this::class }) {
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user