diff options
author | Appability <appable@icloud.com> | 2022-10-12 20:48:51 -0700 |
---|---|---|
committer | Appability <appable@icloud.com> | 2022-10-12 20:48:51 -0700 |
commit | c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8 (patch) | |
tree | f362a5f60f31e27f1567c7319a78d861b19430a7 /src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt | |
parent | 03728b81851af00cd265fadd4ce6eaa3a8066dcb (diff) | |
download | AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.gz AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.tar.bz2 AmbientAddons-c599ee0d78ed8bc17488636f2d9b9b1d5b6dd4a8.zip |
uh a lot of things
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt')
-rw-r--r-- | src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt b/src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt new file mode 100644 index 0000000..cbf4cd9 --- /dev/null +++ b/src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt @@ -0,0 +1,30 @@ +package com.ambientaddons.features.keybinds + +import AmbientAddons.Companion.keyBinds +import AmbientAddons.Companion.mc +import com.ambientaddons.events.MessageSentEvent +import com.ambientaddons.utils.SkyBlock +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.InputEvent + +object SendLastMessageKeybind { + var lastMessage: String? = null + + @SubscribeEvent + fun onSendChat(event: MessageSentEvent) { + if (!SkyBlock.onHypixel) return + if (event.message.startsWith("/pc", ignoreCase = true)) { + lastMessage = event.message.substring(4 until event.message.length) + } else if (!event.message.startsWith("/")) { + lastMessage = event.message + } + } + + @SubscribeEvent + fun onKey(event: InputEvent.KeyInputEvent) { + if (!SkyBlock.onHypixel) return + if (keyBinds["spamKey"]!!.isPressed && lastMessage != null) { + mc.thePlayer.sendChatMessage("/pc $lastMessage") + } + } +}
\ No newline at end of file |