aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/features/keybinds
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/features/keybinds')
-rw-r--r--src/main/kotlin/com/ambientaddons/features/keybinds/PerspectiveKeybind.kt18
-rw-r--r--src/main/kotlin/com/ambientaddons/features/keybinds/SendLastMessageKeybind.kt30
2 files changed, 48 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/features/keybinds/PerspectiveKeybind.kt b/src/main/kotlin/com/ambientaddons/features/keybinds/PerspectiveKeybind.kt
new file mode 100644
index 0000000..3ee1564
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/features/keybinds/PerspectiveKeybind.kt
@@ -0,0 +1,18 @@
+package com.ambientaddons.features.keybinds
+
+import AmbientAddons.Companion.keyBinds
+import AmbientAddons.Companion.mc
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+
+object PerspectiveKeybind {
+ @SubscribeEvent
+ fun onKey(event: KeyInputEvent) {
+ val settings = mc.gameSettings
+ if (keyBinds["thirdPersonKey"]!!.isPressed) {
+ settings.thirdPersonView = if (settings.thirdPersonView == 0) 1 else 0
+ } else if (keyBinds["secondPersonKey"]!!.isPressed) {
+ settings.thirdPersonView = if (settings.thirdPersonView == 0) 2 else 0
+ }
+ }
+}
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