Fix 1.0.0.1

Fix arguments of command
This commit is contained in:
redtea committed 2024-03-25 23:04:37 +03:00
1 parent e6c7eeda34
commit 050b1a5344
2 files changed
+6 -4

No files matched your search

+3 -1
View File
@@ -43,4 +43,6 @@ bin/
protected
.idea
.idea
secret/gradle.properties
secret/secret.txt
@@ -36,19 +36,19 @@ class ExecutorContext(var sender: CommandSender, val args: Array<String>) {
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) ?: "")
}