diff options
author | DoKM <mcazzyman@gmail.com> | 2021-08-16 22:13:37 +0200 |
---|---|---|
committer | DoKM <mcazzyman@gmail.com> | 2021-08-16 22:13:37 +0200 |
commit | 63ae2fa539ff608f07350fad7235234ef26828a8 (patch) | |
tree | 80f513bc0c46ab65d2fe5f9f449b6ccd0544e747 | |
parent | 7cdef907c08e2378d97428945bcd0075e6c89347 (diff) | |
download | NotEnoughUpdates-63ae2fa539ff608f07350fad7235234ef26828a8.tar.gz NotEnoughUpdates-63ae2fa539ff608f07350fad7235234ef26828a8.tar.bz2 NotEnoughUpdates-63ae2fa539ff608f07350fad7235234ef26828a8.zip |
Fix slotlocking a bit more
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 11351857..7f981092 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -99,10 +99,11 @@ public class SlotLocking { public void changedSlot(int slotNumber){ int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; if(pingModifier == 0){ return; }; + if(!isSlotIndexLocked(slotNumber)){ return;} long currentTimeMilis = System.currentTimeMillis(); for (int i = 0; i < slotChanges.length; i++) { - if(i != slotNumber && slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ + if(i != slotNumber && slotChanges[i] != 0 && (slotChanges[i] + (long) pingModifier) > currentTimeMilis){ slotChanges[i] = 0; } } @@ -115,10 +116,8 @@ public class SlotLocking { long currentTimeMilis = System.currentTimeMillis(); for (int i = 0; i < slotChanges.length; i++) { - if(slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ - if(isSlotIndexLocked(i)){ - return true; - } + if (slotChanges[i] != 0 && isSlotIndexLocked(i) && (slotChanges[i] + (long) pingModifier) > currentTimeMilis) { + return true; } } return false; |