From 8c5cc006c8a94555ac8ff1ba159465cb6755e6cd Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 26 Jul 2023 13:40:32 +0200 Subject: add support for sendcoords with description --- .../features/commands/SendCoordinatedCommand.kt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/commands') diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt index c9055976a..8cc303fcf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt @@ -15,14 +15,22 @@ class SendCoordinatedCommand { val message = packet.message.lowercase() if (message == "/sendcoords") { event.isCanceled = true - val location = LocationUtils.playerLocation() - val x = location.x.toInt() - val y = location.y.toInt() - val z = location.z.toInt() - LorenzUtils.sendMessageToServer("x: $x, y: $y, z: $z") + LorenzUtils.sendMessageToServer(getCoordinates()) + } else if (message.startsWith("/sendcoords ")) { + event.isCanceled = true + val description = message.split(" ").drop(1).joinToString(" ") + LorenzUtils.sendMessageToServer("${getCoordinates()} $description") } } } + private fun getCoordinates(): String { + val location = LocationUtils.playerLocation() + val x = location.x.toInt() + val y = location.y.toInt() + val z = location.z.toInt() + return "x: $x, y: $y, z: $z" + } + } \ No newline at end of file -- cgit