From 51ff1f91e9a111734df4c2cfee08d5c57b765340 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 23 Aug 2020 16:55:13 +0800 Subject: [PATCH] Add Plugin.description --- .../kotlin/net/mamoe/mirai/console/data/PluginData.kt | 9 +-------- .../main/kotlin/net/mamoe/mirai/console/plugin/Plugin.kt | 5 +++++ .../net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt index 4de85b27b..32e5d6e69 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/data/PluginData.kt @@ -65,14 +65,7 @@ import kotlin.reflect.KType * val theList = AccountPluginData.list * ``` * - * 但也注意, 不要存储 `AccountPluginData.list`. 它可能受不到值跟踪. - * 错误的示例: - * ``` - * - * class { - * - * } - * ``` + * 但也注意, 不要存储 `AccountPluginData.list`. 它可能受不到值跟踪. 若必要存储, 请使用 [PluginData.findBackingFieldValue] * * ### 使用 Java * diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/Plugin.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/Plugin.kt index eb6be73ee..24111e985 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/Plugin.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/Plugin.kt @@ -39,6 +39,11 @@ public interface Plugin : CommandOwner { * 所属插件加载器实例, 此加载器必须能加载这个 [Plugin]. */ public val loader: PluginLoader<*, *> + + /** + * 获取插件描述 + */ + public val description: PluginDescription } /** diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt index a76706271..5a58bf433 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugin/jvm/JvmPlugin.kt @@ -43,7 +43,7 @@ public interface JvmPlugin : Plugin, CoroutineScope, public val logger: MiraiLogger /** 插件描述 */ - public val description: JvmPluginDescription + public override val description: JvmPluginDescription /** 所属插件加载器实例 */ @JvmDefault