diff options
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt | 10 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt | 4 |
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 |