diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/AbstractInstrumentScreen.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/AbstractInstrumentScreen.java index 02d4c2b..639c5f6 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/AbstractInstrumentScreen.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/AbstractInstrumentScreen.java @@ -199,7 +199,7 @@ public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) { } @Override public boolean keyReleased(int pKeyCode, int pScanCode, int pModifiers) { - unlockFocused(); + unlockFocused(pKeyCode); final NoteButton note = getNoteByKey(pKeyCode); if (note != null) @@ -224,6 +224,7 @@ public NoteButton getNoteByKey(final int keyCode) { return noteMap().containsKey(key) ? noteMap().get(key) : null; } + /** * Unlocks any focused {@link NoteButton}s */ @@ -234,6 +235,15 @@ private void unlockFocused() { return; } } + /** + * Unlocks the {@link NoteButton} who matches with the given keycode + */ + private void unlockFocused(final int keycode) { + final NoteButton note = getNoteByKey(keycode); + + if (note != null) + note.locked = false; + } //#region Making the options screen function