From 63ae2fa539ff608f07350fad7235234ef26828a8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 16 Aug 2021 22:13:37 +0200 Subject: Fix slotlocking a bit more --- .../moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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; -- cgit