From bac0410a02dafca6b6a291c63f686139199d5b5f Mon Sep 17 00:00:00 2001 From: Dek Date: Sun, 23 Aug 2026 01:22:25 -0400 Subject: [PATCH] Fixed binds without modifiers not matching while a modifier is held --- .../meteorclient/systems/modules/Modules.java | 13 +++++++++++++ .../meteorclient/utils/misc/Keybind.java | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 17e6b9214fe..3f4fc5f8e67 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -279,7 +279,20 @@ private void onMouseClick(MouseClickEvent event) { private void onAction(boolean isKey, int value, int modifiers, boolean isPress) { if (mc.gui.screen() != null || Input.isKeyPressed(InputConstants.KEY_F3)) return; + // A bind with modifiers takes precedence over one without, so pressing Ctrl + G does not + // also toggle a module bound to plain G. + boolean modifierBindMatched = false; + + for (Module module : moduleInstances.values()) { + if (module.keybind.hasMods() && module.keybind.matches(isKey, value, modifiers)) { + modifierBindMatched = true; + break; + } + } + for (Module module : moduleInstances.values()) { + if (modifierBindMatched && !module.keybind.hasMods()) continue; + if (module.keybind.matches(isKey, value, modifiers) && (isPress || (module.toggleOnBindRelease && module.isActive()))) { module.toggle(); module.sendToggledMsg(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/Keybind.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/Keybind.java index daf7b59f7fd..43dfc4f227c 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/Keybind.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/Keybind.java @@ -149,8 +149,10 @@ public boolean canBindTo(boolean isKey, int value, int modifiers) { public boolean matches(InputConstants.Key key, Set modifiers) { if (!isSet() || !this.key.equals(key)) return false; - if (!hasMods()) return modifiers.stream().noneMatch(m -> m == Modifier.SHIFT || m == Modifier.CONTROL || m == Modifier.ALT || m == Modifier.SUPER); - return this.modifiers.equals(modifiers); + // Modifiers held for other reasons (sneaking, sprinting, or the bound key being a modifier + // itself, which sets its own bit on press) must not stop a bind without modifiers from + // matching. Binds that do have modifiers take precedence, see Modules#onAction. + return !hasMods() || this.modifiers.equals(modifiers); } public boolean matches(boolean isKey, int value, int modifiers) {