Skip to content

Commit bf8f6b4

Browse files
committed
feat: allow locking bound slots
(cherry picked from commit 706b7f9)
1 parent 50a8c91 commit bf8f6b4

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/main/kotlin/events/IsSlotProtectedEvent.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ data class IsSlotProtectedEvent(
2121
val itemStack get() = itemStackOverride ?: slot!!.stack
2222

2323
fun protect() {
24+
if (!isProtected) {
25+
silent = false
26+
}
2427
isProtected = true
25-
silent = false
2628
}
2729

2830
fun protectSilent() {
@@ -55,7 +57,7 @@ data class IsSlotProtectedEvent(
5557
.red()
5658
.append(tr("firmament.protectitem.hoverhint", "Hover for more info.").grey())
5759
.hover(tr("firmament.protectitem.hint",
58-
"To unlock this item use the Lock Slot or Lock Item keybind from Firmament while hovering over this item.")))
60+
"To unlock this item use the Lock Slot or Lock Item keybind from Firmament while hovering over this item. If this is a bound slot, you can use disable the Lock Bound Slots setting.")))
5961
CommonSoundEffects.playFailure()
6062
}
6163
return event.isProtected

src/main/kotlin/features/inventory/SlotLocking.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ object SlotLocking {
149149
SavedKeyBinding.keyWithMods(GLFW.GLFW_KEY_L, InputModifiers.of(shift = true))
150150
}
151151
val slotBind by keyBinding("bind") { GLFW.GLFW_KEY_L }
152+
val lockBound by toggle("lock-bind") { false }
152153
val slotBindRequireShift by toggle("require-quick-move") { true }
153154
val slotRenderLines by choice("bind-render") { SlotRenderLinesMode.ONLY_BOXES }
154155
val slotBindOnlyInInv by toggle("bind-only-in-inv") { false }
@@ -253,7 +254,14 @@ object SlotLocking {
253254

254255
@Subscribe
255256
fun onProtectSlot(it: IsSlotProtectedEvent) {
256-
if (it.slot != null && it.slot.inventory is PlayerInventory && it.slot.index in (lockedSlots ?: setOf())) {
257+
if (it.slot != null
258+
&& it.slot.inventory is PlayerInventory
259+
&& (it.slot.index in (lockedSlots ?: setOf())
260+
|| (
261+
TConfig.lockBound &&
262+
currentWorldData.boundSlots.findMatchingSlots(it.slot.index).isNotEmpty())
263+
)
264+
) {
257265
it.protect()
258266
}
259267
}

translations/en_us.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@
396396
"firmament.config.slot-locking.hunting-box": "Protect Hunting Box",
397397
"firmament.config.slot-locking.hunting-box.description": "The Hunting Box frequently changes its UUID, and as such cannot be reliably protected using UUID locking. Instead this option can be used to block from dropping any Hunting Box.",
398398
"firmament.config.slot-locking.lock": "Lock Slot",
399+
"firmament.config.slot-locking.lock-bind": "Lock Bound Slots",
400+
"firmament.config.slot-locking.lock-bind.description": "Prevent moving bound slots, except for slot quick moving.",
399401
"firmament.config.slot-locking.lock-uuid": "Lock UUID (Lock Item)",
400402
"firmament.config.slot-locking.lock-uuid.description": "Lock a SkyBlock item by it's UUID. This blocks a specific item from being dropped/sold, but still allows moving it around.",
401403
"firmament.config.slot-locking.lock.description": "Lock a slot, preventing any item from being moved from, dropped from, or placed into this slot.",

0 commit comments

Comments
 (0)