diff --git a/build.gradle.kts b/build.gradle.kts index f4a4874..0140c6b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "top.jie65535" -version = "0.1.1" +version = "0.1.2" repositories { maven("https://maven.aliyun.com/repository/public") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..68f4317 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/kotlin/JDice.kt b/src/main/kotlin/JDice.kt index cf06afc..b2ed1c3 100644 --- a/src/main/kotlin/JDice.kt +++ b/src/main/kotlin/JDice.kt @@ -12,12 +12,12 @@ object JDice : KotlinPlugin( JvmPluginDescription( id = "top.jie65535.dice", name = "J Dice", - version = "0.1.1", + version = "0.1.2", ) { author("jie65535") } ) { - private val regex = Regex("""\b(\d*)[dD](\d+)\b""") + private val regex = Regex("""\b(\d{0,3})[dD](\d{1,3})\b""") private val random = Random(System.currentTimeMillis()) override fun onEnable() { @@ -27,8 +27,11 @@ object JDice : KotlinPlugin( val (c, d) = it.destructured val count = if (c.isEmpty()) 1 else c.toInt() val top = d.toInt() - if (count > 0 && top > 1) { - val value = random.nextInt(count, count * top + 1) + if (count > 0 && count <= 100 && top > 1 && top <= 100) { + var value = 0 + for (i in 1..count) { + value += random.nextInt(1, top + 1) + } subject.sendMessage(message.quote() + value.toString()) } }