From b4c8b82714c427dd25967d0233b3e7f6a0e6f839 Mon Sep 17 00:00:00 2001 From: limbang <495071565@qq.com> Date: Thu, 19 Dec 2024 01:46:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=88=B3=E4=B8=80=E6=88=B3=E5=B8=AE=E5=8A=A9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- src/main/kotlin/mirai/Minecraft.kt | 5 +++-- src/main/kotlin/mirai/PluginCompositeCommand.kt | 8 ++++++++ src/main/kotlin/mirai/PluginData.kt | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b939b57..cf82585 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "top.limbang" -version = "1.2.2" +version = "1.2.3" repositories { diff --git a/src/main/kotlin/mirai/Minecraft.kt b/src/main/kotlin/mirai/Minecraft.kt index c8effef..5f40680 100644 --- a/src/main/kotlin/mirai/Minecraft.kt +++ b/src/main/kotlin/mirai/Minecraft.kt @@ -18,13 +18,14 @@ import net.mamoe.mirai.event.GlobalEventChannel import net.mamoe.mirai.event.events.NudgeEvent import net.mamoe.mirai.event.registerTo import top.limbang.minecraft.mirai.PluginCompositeCommand.renameServer +import top.limbang.minecraft.mirai.PluginData.isNudgeHelp import top.limbang.mirai.event.GroupRenameEvent object Minecraft : KotlinPlugin( JvmPluginDescription( id = "top.limbang.minecraft", name = "Minecraft", - version = "1.2.2", + version = "1.2.3", ) { author("limbang") info("""Minecraft插件""") @@ -58,7 +59,7 @@ object Minecraft : KotlinPlugin( MinecraftListener.registerTo(eventChannel) eventChannel.subscribeAlways { - if (target.id == bot.id) { + if (target.id == bot.id && isNudgeHelp) { subject.sendMessage( "Minecraft 插件使用说明:\n" + "Ping服务器:$ping 服务器名称\n" + diff --git a/src/main/kotlin/mirai/PluginCompositeCommand.kt b/src/main/kotlin/mirai/PluginCompositeCommand.kt index 630a48a..e8b9321 100644 --- a/src/main/kotlin/mirai/PluginCompositeCommand.kt +++ b/src/main/kotlin/mirai/PluginCompositeCommand.kt @@ -16,6 +16,7 @@ import net.mamoe.mirai.console.plugin.id import net.mamoe.mirai.contact.Group import net.mamoe.mirai.event.broadcast import top.limbang.minecraft.mirai.PluginData.isAllToImg +import top.limbang.minecraft.mirai.PluginData.isNudgeHelp import top.limbang.minecraft.mirai.PluginData.serverMap import top.limbang.mirai.event.GroupRenameEvent @@ -82,4 +83,11 @@ object PluginCompositeCommand : CompositeCommand(Minecraft, "mc") { isAllToImg = value sendMessage("All消息转换为图片功能:$isAllToImg") } + + @SubCommand + @Description("设置是否开启戳一戳帮助功能") + suspend fun CommandSender.setNudgeHelp(value: Boolean) { + isNudgeHelp = value + sendMessage("戳一戳帮助功能:$isNudgeHelp") + } } \ No newline at end of file diff --git a/src/main/kotlin/mirai/PluginData.kt b/src/main/kotlin/mirai/PluginData.kt index 6238e81..864b24c 100644 --- a/src/main/kotlin/mirai/PluginData.kt +++ b/src/main/kotlin/mirai/PluginData.kt @@ -37,4 +37,7 @@ object PluginData : AutoSavePluginData("minecraft") { @ValueDescription("All消息是否是图片,默认 false") var isAllToImg: Boolean by value(false) + + @ValueDescription("是否开启戳一戳帮助功能,默认 true") + var isNudgeHelp: Boolean by value(true) }