mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 08:49:41 +00:00
Fixed KeyPreset not fully respecting SHIFT/ALT/CTRL modifiers + removed redundant code
This commit is contained in:
1 parent
1ac7c0e797
commit
950a749be6
2 files changed
+3
-37
No files matched your search
@@ -11,10 +11,8 @@ import java.util.List;
|
||||
|
||||
public class KeyPresetManager {
|
||||
public List<KeyPreset> keys = new ArrayList<>();
|
||||
public List<KeyPreset> keysSorted = new ArrayList<>();
|
||||
public String fileName;
|
||||
|
||||
private boolean wasSorted = false;
|
||||
|
||||
public KeyPresetManager(String fileName) {
|
||||
this.fileName = fileName;
|
||||
@@ -23,22 +21,12 @@ public class KeyPresetManager {
|
||||
public KeyPreset add(String name) {
|
||||
KeyPreset preset = new KeyPreset(name);
|
||||
keys.add(preset);
|
||||
keysSorted.add(preset);
|
||||
wasSorted = false;
|
||||
return preset;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (!wasSorted) {
|
||||
keysSorted.sort(KeyPreset::compareTo);
|
||||
wasSorted = true;
|
||||
}
|
||||
|
||||
for (KeyPreset key : keysSorted) {
|
||||
for (KeyPreset key : keys)
|
||||
key.tick();
|
||||
if (key.isDown && key.shouldConflict)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user