Release v1.0.0
Full Changelog: https://github.com/sya-ri/commandapi-kotlin-improved/commits/1.0.0
Improve CommandAPI Kotlin DSL.
- A better alternative library to official Kotlin DSL
- shorter, more type-safe code
- Code compatibility. Change the import, and it will work (but doesn't support CommandAPICommand)
- You can also cast by specifying the node name in the same way as the official one.
- Recommend to obtain it via a getter.
What's CommandAPI?
![]()
A Bukkit/Spigot API to use the command UI introduced in Minecraft 1.13
A great library for creating Minecraft commands. It's a library written in Java and also features a Kotlin DSL. But it's not type safe.
Installation
- Replace
dev.jorel:commandapi-bukkit-kotlinwith this library.
dependencies {
implementation("dev.s7a:commandapi-bukkit-kotlin-improved:1.0.0")
}Examples
Official dev.jorel:commandapi-bukkit-kotlin
Caution
Requires casts and enters the correct node name.
fun registerCommand() {
commandTree("example") {
literalArgument("integer") {
integerArgument("value") {
anyExecutor { sender, args ->
val value = args.get("value") as Int // Dangerous!!!
sender.sendMessage("You entered: $value")
}
}
}
}
}Improved dev.s7a:commandapi-bukkit-kotlin-improved
Important
Type-safe values can be obtained just by passing CommandArguments.
fun registerCommand() {
commandTree("example") {
literalArgument("integer") {
integerArgument("value") { getValue ->
anyExecutor { sender, args ->
val value = getValue(args) // Returns Int
sender.sendMessage("You entered: $value")
}
}
}
}
}