From 1b03074c6cfa4b1ef35cef1682b29c9b60be676d Mon Sep 17 00:00:00 2001 From: jie65535 Date: Tue, 5 Apr 2022 19:49:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=20=E5=A2=9E=E5=8A=A0=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E6=8A=BC=E9=A9=AC=20`=E9=A9=AC=3F=20100`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- src/main/kotlin/JHRCommand.kt | 6 +++--- src/main/kotlin/JHorseRacing.kt | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8e3a30f..918b73d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ plugins { kotlin("jvm") version kotlinVersion kotlin("plugin.serialization") version kotlinVersion - id("net.mamoe.mirai-console") version "2.9.2" + id("net.mamoe.mirai-console") version "2.10.1" } group = "top.jie65535" diff --git a/src/main/kotlin/JHRCommand.kt b/src/main/kotlin/JHRCommand.kt index 405fc03..aec3275 100644 --- a/src/main/kotlin/JHRCommand.kt +++ b/src/main/kotlin/JHRCommand.kt @@ -9,7 +9,7 @@ object JHRCommand : CompositeCommand( description = "HorseRacing Commands" ) { @SubCommand - @Deprecated("开启赛马") + @Description("开启赛马") suspend fun CommandSender.enable(group: Long) { if (JHRPluginConfig.enabledGroups.indexOf(group) == -1) JHRPluginConfig.enabledGroups.add(group) @@ -17,13 +17,13 @@ object JHRCommand : CompositeCommand( } @SubCommand - @Deprecated("开启赛马") + @Description("开启赛马") suspend fun CommandSender.disable(group: Long) { JHRPluginConfig.enabledGroups.remove(group) sendMessage("OK") } @SubCommand - @Deprecated("重载配置") + @Description("重载配置") suspend fun CommandSender.reload() { JHorseRacing.reloadPluginConfig(JHRPluginConfig) sendMessage("OK") diff --git a/src/main/kotlin/JHorseRacing.kt b/src/main/kotlin/JHorseRacing.kt index 70ce4ec..1d4f53f 100644 --- a/src/main/kotlin/JHorseRacing.kt +++ b/src/main/kotlin/JHorseRacing.kt @@ -328,7 +328,11 @@ object JHorseRacing : KotlinPlugin( if (p.size != 2) { return@subscribeAlways } - val no = p[0].toIntOrNull() + val no = if (p[0] == "?" || p[0] == "?") { + Random.nextInt(horseCount) + 1 + } else { + p[0].toIntOrNull() + } if (no == null || no < 1 || no > horseCount) { subject.sendMessage("没有这个编号的选手") return@subscribeAlways