From 26872b082af40c7af7df8cce6e6d8db9f5118296 Mon Sep 17 00:00:00 2001 From: Dragonkiller93 <82484852+Dragonkiller93@users.noreply.github.com> Date: Sat, 19 Jul 2025 18:02:32 -0700 Subject: [PATCH] Close setup when bank closes --- .../java/inventorysetups/InventorySetupsConfig.java | 11 +++++++++++ .../java/inventorysetups/InventorySetupsPlugin.java | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/main/java/inventorysetups/InventorySetupsConfig.java b/src/main/java/inventorysetups/InventorySetupsConfig.java index b39b812..0cc64aa 100644 --- a/src/main/java/inventorysetups/InventorySetupsConfig.java +++ b/src/main/java/inventorysetups/InventorySetupsConfig.java @@ -29,6 +29,7 @@ import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_LAYOUT_DEFAULT; import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_LAYOUT_DUPLICATES; import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_MANUAL_BANK_FILTER; +import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_CLOSE_WITH_BANK; import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_PANEL_VIEW; import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_PERSIST_HOTKEYS; import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_SECTION_MODE; @@ -511,6 +512,16 @@ default boolean enableLayoutWarning() return true; } + @ConfigItem( + keyName = CONFIG_KEY_CLOSE_WITH_BANK, + name = "Close with Bank", + description = "Close your current setup when you close the bank", + section = otherSection + ) + default boolean closeWithBank() + { + return false; + } } diff --git a/src/main/java/inventorysetups/InventorySetupsPlugin.java b/src/main/java/inventorysetups/InventorySetupsPlugin.java index 80a9d89..53afea7 100644 --- a/src/main/java/inventorysetups/InventorySetupsPlugin.java +++ b/src/main/java/inventorysetups/InventorySetupsPlugin.java @@ -142,6 +142,7 @@ public class InventorySetupsPlugin extends Plugin public static final String CONFIG_KEY_VERSION_STR = "version"; public static final String CONFIG_KEY_UNASSIGNED_MAXIMIZED = "unassignedMaximized"; public static final String CONFIG_KEY_MANUAL_BANK_FILTER = "manualBankFilter"; + public static final String CONFIG_KEY_CLOSE_WITH_BANK = "closeWithBank"; public static final String CONFIG_KEY_PERSIST_HOTKEYS = "persistHotKeysOutsideBank"; public static final String CONFIG_KEY_USE_LAYOUTS = "useLayouts"; public static final String CONFIG_KEY_LAYOUT_DEFAULT = "defaultLayout"; @@ -897,7 +898,11 @@ private void onWidgetClosed(WidgetClosed event) { unregisterHotkeys(); } + if (config.closeWithBank()) + { + clientThread.invokeLater(() -> panel.returnToOverviewPanel(false)); + } if (isInventorySetupTagOpen()) { // Close the bank tag for those who use manual bank filter