aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt19
1 files 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<String, String> = 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() {