aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrady <thatgravyboat@gmail.com>2024-06-12 14:15:18 -0230
committerGitHub <noreply@github.com>2024-06-12 18:45:18 +0200
commite6d4aea4b0bff9438beefd78e59ff17479182404 (patch)
tree2cb9b558fb7aa79254e909b5a4abe281c1913dd5
parent51caf09cc9b0c24aec9c9f82e895ff1529cc8cb1 (diff)
downloadskyhanni-e6d4aea4b0bff9438beefd78e59ff17479182404.tar.gz
skyhanni-e6d4aea4b0bff9438beefd78e59ff17479182404.tar.bz2
skyhanni-e6d4aea4b0bff9438beefd78e59ff17479182404.zip
Fix: isKeyHeld crash (#2066)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
index 9bf129be2..dbdccb72a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
@@ -88,7 +88,7 @@ object KeyboardManager {
lastClickedMouseButton = -1
}
- // I don't know when this is needed
+ // This is needed because of other keyboards that don't have a key code for the key, but is read as a character
if (Keyboard.getEventKey() == 0) {
LorenzKeyPressEvent(Keyboard.getEventCharacter().code + 256).postAndCatch()
}
@@ -112,8 +112,11 @@ object KeyboardManager {
if (this == 0) return false
return if (this < 0) {
Mouse.isButtonDown(this + 100)
+ } else if (this >= Keyboard.KEYBOARD_SIZE) {
+ val pressedKey = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey()
+ Keyboard.getEventKeyState() && this == pressedKey
} else {
- KeybindHelper.isKeyDown(this)
+ Keyboard.isKeyDown(this)
}
}