summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/commands')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt28
1 files changed, 28 insertions, 0 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
new file mode 100644
index 000000000..c9055976a
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/SendCoordinatedCommand.kt
@@ -0,0 +1,28 @@
+package at.hannibal2.skyhanni.features.commands
+
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.network.play.client.C01PacketChatMessage
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class SendCoordinatedCommand {
+
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+ if (packet is C01PacketChatMessage) {
+ 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")
+ }
+ }
+ }
+
+
+} \ No newline at end of file