aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-26 13:40:32 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-26 13:40:32 +0200
commit8c5cc006c8a94555ac8ff1ba159465cb6755e6cd (patch)
treea457219879c808b7e1b12cc0156ff94bf8adeefb /src/main/java/at/hannibal2
parentc9080139998fadd90286d42292e69b99e2ec942a (diff)
downloadskyhanni-8c5cc006c8a94555ac8ff1ba159465cb6755e6cd.tar.gz
skyhanni-8c5cc006c8a94555ac8ff1ba159465cb6755e6cd.tar.bz2
skyhanni-8c5cc006c8a94555ac8ff1ba159465cb6755e6cd.zip
add support for sendcoords with description
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt18
2 files changed, 26 insertions, 10 deletions
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
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
index 195f1b06c..520957830 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
@@ -30,11 +30,19 @@ class PatcherSendCoordinates {
val message = event.message.removeColor()
pattern.matchMatcher(message) {
- val playerName = group("playerName").split(" ").last()
- val x = group("x").trim().toInt()
- val y = group("y").trim().toInt()
- val z = group("z").trim().toInt()
- patcherBeacon.add(PatcherBeacon(LorenzVec(x, y, z), playerName, System.currentTimeMillis() / 1000))
+ var description = group("playerName").split(" ").last()
+ val x = group("x").toInt()
+ val y = group("y").toInt()
+
+ val end = group("z")
+ val z = if (end.contains(" ")) {
+ val split = end.split(" ")
+ val extra = split.drop(1).joinToString(" ")
+ description += " " + extra
+
+ split.first().toInt()
+ } else end.toInt()
+ patcherBeacon.add(PatcherBeacon(LorenzVec(x, y, z), description, System.currentTimeMillis() / 1000))
logger.log("got patcher coords and username")
}
}