From e6d4aea4b0bff9438beefd78e59ff17479182404 Mon Sep 17 00:00:00 2001 From: Brady Date: Wed, 12 Jun 2024 14:15:18 -0230 Subject: Fix: isKeyHeld crash (#2066) --- src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/java') 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) } } -- cgit