diff options
| author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-06-20 01:49:05 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-19 17:49:05 +0200 |
| commit | 2a3536bfb4e6c09287c2e2239c5a3b86aefd630d (patch) | |
| tree | 899140d616f9f9f671b780474bfb349eb26f85a6 | |
| parent | fe73a61246bf4ef1cdeccfec100ba4d8376ee8ea (diff) | |
| download | notenoughupdates-2a3536bfb4e6c09287c2e2239c5a3b86aefd630d.tar.gz notenoughupdates-2a3536bfb4e6c09287c2e2239c5a3b86aefd630d.tar.bz2 notenoughupdates-2a3536bfb4e6c09287c2e2239c5a3b86aefd630d.zip | |
Add toggle to disable slot locking in storage (#1199)
Co-authored-by: jani270 <69345714+jani270@users.noreply.github.com>
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 20 | ||||
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/SlotLocking.java | 8 |
2 files changed, 28 insertions, 0 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 f3757243..8f11f5c7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -62,6 +62,8 @@ import org.lwjgl.util.vector.Vector2f; import java.io.File; import java.util.Arrays; import java.util.HashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; @NEUAutoSubscribe public class SlotLocking { @@ -156,11 +158,29 @@ public class SlotLocking { ConfigUtil.saveConfig(config, file, GSON); } + + private static final Pattern WINDOW_REGEX = Pattern.compile(".+ Backpack (?:✦ )?\\(Slot #(\\d+)\\)"); + private static final Pattern ECHEST_WINDOW_REGEX = Pattern.compile("Ender Chest \\((\\d+)/(\\d+)\\)"); + + private LockedSlot[] getDataForProfile() { if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() || !NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking) return null; + if (NotEnoughUpdates.INSTANCE.config.slotLocking.disableInStorage) { + if (StorageManager.getInstance().isStorageOpen) return null; + String openChestName = Utils.getOpenChestName(); + if (openChestName.trim().equals("Storage")) return null; + + Matcher matcher = WINDOW_REGEX.matcher(openChestName); + Matcher matcherEchest = ECHEST_WINDOW_REGEX.matcher(openChestName); + + if (matcher.matches() || matcherEchest.matches()) { + return null; + } + } + String profileName = SBInfo.getInstance().currentProfile; if (profileName == null) profileName = "generic"; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/SlotLocking.java index 45422347..e373747f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/SlotLocking.java @@ -78,6 +78,14 @@ public class SlotLocking { public boolean lockSlotsInTrade = true; @Expose + @ConfigOption( + name = "Disable Locking in Storage", + desc = "Disables slot locking and binding in the storage gui" + ) + @ConfigEditorBoolean + public boolean disableInStorage = false; + + @Expose /*@ConfigOption( name = "Item Swap drop delay", desc = "Set the delay between swapping to another item and being able to drop it.\n"+ |
