From 050b1a5344a6f364794d815abbeb95229ce90e87 Mon Sep 17 00:00:00 2001 From: Denis Istratov Date: Mon, 25 Mar 2024 23:04:37 +0300 Subject: [PATCH] Fix 1.0.0.1 Fix arguments of command --- .gitignore | 4 +++- .../kotlinbukkitkit/commands/dsl/ExecutorContext.kt | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 3a55b6c..c1b77f3 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,6 @@ bin/ protected -.idea \ No newline at end of file +.idea +secret/gradle.properties +secret/secret.txt diff --git a/commands/src/main/kotlin/tech/carcadex/kotlinbukkitkit/commands/dsl/ExecutorContext.kt b/commands/src/main/kotlin/tech/carcadex/kotlinbukkitkit/commands/dsl/ExecutorContext.kt index 756e31f..ed76bf0 100644 --- a/commands/src/main/kotlin/tech/carcadex/kotlinbukkitkit/commands/dsl/ExecutorContext.kt +++ b/commands/src/main/kotlin/tech/carcadex/kotlinbukkitkit/commands/dsl/ExecutorContext.kt @@ -36,19 +36,19 @@ class ExecutorContext(var sender: CommandSender, val args: Array) { MessagesService.byTag("#no-such-material")(sender) throw TypeParseException() } - fun worldOrNull(index: Int): World? = Bukkit.getWorld(string(index)) + fun worldOrNull(index: Int): World? = Bukkit.getWorld(argument(index) ?: "") fun world(index: Int): World = worldOrNull(index) ?: run { MessagesService.byTag("#no-such-world")(sender) throw TypeParseException() } - fun playerOrNull(index: Int): Player? = Bukkit.getPlayer(string(index)) + fun playerOrNull(index: Int): Player? = Bukkit.getPlayer(argument(index) ?: "") fun player(index: Int): World = worldOrNull(index) ?: run { MessagesService.byTag("#no-such-player")(sender) throw TypeParseException() } - fun offlinePlayer(index: Int): OfflinePlayer = Bukkit.getOfflinePlayer(string(index)) + fun offlinePlayer(index: Int): OfflinePlayer = Bukkit.getOfflinePlayer(argument(index) ?: "") } \ No newline at end of file