From f3f6da9f50edfbe9ed3be42fa16146210e60fbf3 Mon Sep 17 00:00:00 2001 From: inglettronald Date: Sat, 10 Jun 2023 21:38:38 -0500 Subject: yeah I'm not documenting this today --- src/main/kotlin/com/dulkirfabric/features/KeyShortCutImpl.kt | 10 ++++++++++ src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) delete mode 100644 src/main/kotlin/com/dulkirfabric/features/NoReverseCam.kt (limited to 'src/main/kotlin/com/dulkirfabric/features') 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 -- cgit