aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-06-10 21:38:38 -0500
committeringlettronald <inglettronald@gmail.com>2023-06-10 21:38:38 -0500
commitf3f6da9f50edfbe9ed3be42fa16146210e60fbf3 (patch)
tree96c54aa7de1bd2d79d062ad0f787e46c88034a83 /src/main/kotlin/com/dulkirfabric/features
parent22508bb83e8d5846a7a68dd5346e8a2013e1c710 (diff)
downloadDulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.tar.gz
DulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.tar.bz2
DulkirMod-Fabric-f3f6da9f50edfbe9ed3be42fa16146210e60fbf3.zip
yeah I'm not documenting this today
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt10
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt4
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
index c94c258..9d2d39f 100644
--- a/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt
@@ -6,10 +6,20 @@ import com.dulkirfabric.util.TextUtils
import meteordevelopment.orbit.EventHandler
object KeyShortCutImpl {
+ private var lastCommandHandle: Long = 0
+ private var prevCode: Int = 0;
+
@EventHandler
fun onKeyPress(event: WorldKeyPressEvent) {
DulkirConfig.configOptions.macrosList.forEach {
if (it.keyBinding.code == event.key) {
+ // Spam Prevention
+ if (event.key == prevCode && System.currentTimeMillis() - lastCommandHandle < 1000)
+ return
+
+ lastCommandHandle = System.currentTimeMillis()
+ prevCode = event.key
+
// This conditional allows for these shortcuts to work for commands or normal messages
if (it.command.startsWith("/"))
TextUtils.sendCommand(it.command.substring(1))
diff --git a/src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt b/src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt
deleted file mode 100644
index b8cb36d..0000000
--- a/src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.dulkirfabric.features
-
-class NoReverseCam {
-} \ No newline at end of file