From a420116af642a1eb8b257e8a88cece92eecc6def Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 27 Oct 2024 22:42:58 +0100 Subject: added response to /shcopylocation --- .../hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index ae9b5e45b..4a19357f1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -328,18 +328,15 @@ object SkyHanniDebugsAndTests { val x = (location.x + 0.001).roundTo(1) val y = (location.y + 0.001).roundTo(1) val z = (location.z + 0.001).roundTo(1) - if (args.size == 1) { - if (args[0].equals("json", false)) { - OSUtils.copyToClipboard("\"$x:$y:$z\"") - return - } - if (args[0].equals("pathfind", false)) { - OSUtils.copyToClipboard("`/shtestwaaypoint $x $y $z pathfind`") - return - } - } + val (clipboard, format) = formatLocation(x, y, z, args.getOrNull(0)) + OSUtils.copyToClipboard(clipboard) + ChatUtils.chat("Copied the current location to clipboard ($format format)!", replaceSameMessage = true) + } - OSUtils.copyToClipboard("LorenzVec($x, $y, $z)") + private fun formatLocation(x: Double, y: Double, z: Double, parameter: String?): Pair = when (parameter) { + "json" -> "$x:$y:$z" to "json" + "pathfind" -> "`/shtestwaypoint $x $y $z pathfind`" to "pathfind" + else -> "LorenzVec($x, $y, $z)" to "LorenzVec" } fun debugVersion() { -- cgit