Compare commits

...
2 Commits
Author SHA1 Message Date
Hare e0613cd052 feat: bootの対応 2025-12-07 04:20:43 +09:00
Hare 3671948bfe chore: ignore追加 2025-12-07 04:04:44 +09:00
4 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
.kotlin
.gradle
build
din
bin
@@ -23,6 +23,20 @@ object WordArgumentType : KommandArgumentType<String> {
}
}
object BooleanArgumentType : KommandArgumentType<Boolean> {
override fun parse(input: String, context: KommandContext): ArgumentParseResult<Boolean> {
val lower = input.lowercase()
return when (lower) {
"true" -> ArgumentParseResult.Success(true)
"false" -> ArgumentParseResult.Success(false)
else -> ArgumentParseResult.Failure("Expected true/false but got '$input'")
}
}
override fun suggestions(context: KommandContext, prefix: String): List<String> =
listOf("true", "false").filter { it.startsWith(prefix, ignoreCase = true) }
}
class IntegerArgumentType(
val min: Int? = null,
val max: Int? = null
@@ -147,6 +147,11 @@ abstract class BranchScope internal constructor(
block: ValueBuilder<Double>.() -> Unit = {}
) = argument(name, FloatArgumentType(min, max), block)
fun bool(
name: String,
block: ValueBuilder<Boolean>.() -> Unit = {}
) = argument(name, BooleanArgumentType, block)
fun player(
name: String,
allowSelectors: Boolean = true,