1.0.0.2
Command fixes, new extensions
This commit is contained in:
1 parent
050b1a5344
commit
2af1b2d8ba
5 files changed
+16
-33
No files matched your search
@@ -1,21 +0,0 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands
|
||||
|
||||
import tech.carcadex.kotlinbukkitkit.architecture.KotlinPlugin
|
||||
import tech.carcadex.kotlinbukkitkit.commands.dsl.builder.simpleCommand
|
||||
|
||||
fun KotlinPlugin.onEnable() {
|
||||
simpleCommand(
|
||||
name = "test",
|
||||
permission = "test.use",
|
||||
tabComplete = listOf("subcmd1", "subcmd2")
|
||||
) {
|
||||
sender.sendMessage("test")
|
||||
val arg1 = argument(0) //getting 1 argument of command as nullable string
|
||||
//also you can use stringOrNull
|
||||
val arg2 = string(1) //getting 1 argument of command as string
|
||||
val arg3 = integer(2) //getting 2 argument of command as integer
|
||||
//also you can use integerOrNull
|
||||
val arg4 = double(3) //getting 3 argument of command as integer
|
||||
//also you can use doubleOrNull
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package tech.carcadex.kotlinbukkitkit.commands.extensions
|
||||
|
||||
import org.bukkit.command.CommandSender
|
||||
|
||||
typealias Sender = CommandSender;
|
||||
-1
@@ -11,7 +11,6 @@ object MessagesService {
|
||||
messages["#no-such-player"] = { it.sendMessage("${ChatColor.RED}No such player was found") }
|
||||
messages["#no-such-world"] = { it.sendMessage("${ChatColor.RED}No such world was found") }
|
||||
messages["#no-such-material"] = { it.sendMessage("${ChatColor.RED}No such material was found") }
|
||||
messages["#no-such-world"] = { it.sendMessage("${ChatColor.RED}No such world was found") }
|
||||
messages["#no-such-enum"] = { it.sendMessage("${ChatColor.RED}No such value for this enum was found") }
|
||||
messages["#not-a-number"] = { it.sendMessage("${ChatColor.RED}It is not a number") }
|
||||
messages["#wrong-usage"] = { it.sendMessage("${ChatColor.RED}Wrong usage of command") }
|
||||
|
||||
Reference in new issue
Block a user