Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/inventorysetups/InventorySetupsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_HIDE_BUTTON;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_MANUAL_BANK_FILTER;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_REMEMBER_LAST_SETUP;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_PANEL_VIEW;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_PERSIST_HOTKEYS;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_SECTION_MODE;
Expand Down Expand Up @@ -456,6 +457,17 @@ default boolean manualBankFilter()
return false;
}

@ConfigItem(
keyName = CONFIG_KEY_REMEMBER_LAST_SETUP,
name = "Remember Last Setup",
description = "If a setup was active previously, it will be opened when the client or plugin starts",
position = 28
)
default boolean rememberLastSetup()
{
return false;
}



}
19 changes: 18 additions & 1 deletion src/main/java/inventorysetups/InventorySetupsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ 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_REMEMBER_LAST_SETUP = "rememberLastSetup";
public static final String CONFIG_KEY_LAST_SETUP_VALUE = "lastSetupValue";
public static final String CONFIG_KEY_PERSIST_HOTKEYS = "persistHotKeysOutsideBank";
public static final String TUTORIAL_LINK = "https://github.com/dillydill123/inventory-setups#inventory-setups";
public static final String SUGGESTION_LINK = "https://github.com/dillydill123/inventory-setups/issues";
Expand Down Expand Up @@ -863,7 +865,22 @@ public void startUp()
clientThread.invokeLater(() ->
{
dataManager.loadConfig();
SwingUtilities.invokeLater(() -> panel.redrawOverviewPanel(true));
SwingUtilities.invokeLater(() ->
{
panel.redrawOverviewPanel(true);
if (config.rememberLastSetup())
{
String lastSetupName = configManager.getConfiguration(CONFIG_GROUP, CONFIG_KEY_LAST_SETUP_VALUE);
if (!lastSetupName.isEmpty())
{
final InventorySetup lastSetup = getCache().getInventorySetupNames().get(lastSetupName);
if (lastSetup != null)
{
panel.setCurrentInventorySetup(lastSetup, true);
}
}
}
});
});

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_PANEL_VIEW;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_SECTION_MODE;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_UNASSIGNED_MAXIMIZED;
import static inventorysetups.InventorySetupsPlugin.CONFIG_KEY_LAST_SETUP_VALUE;
import static inventorysetups.InventorySetupsPlugin.TUTORIAL_LINK;

import inventorysetups.InventorySetupsSection;
Expand Down Expand Up @@ -445,6 +446,7 @@ public void mousePressed(MouseEvent e)
if (SwingUtilities.isLeftMouseButton(e))
{
redrawOverviewPanel(false);
plugin.setConfigValue(CONFIG_KEY_LAST_SETUP_VALUE, "");
}
}

Expand Down Expand Up @@ -754,6 +756,7 @@ public void setCurrentInventorySetup(final InventorySetup inventorySetup, boolea
plugin.setBankFilteringMode(InventorySetupsFilteringModeID.ALL);
plugin.doBankSearch();

plugin.setConfigValue(CONFIG_KEY_LAST_SETUP_VALUE, inventorySetup.getName());
validate();
repaint();

Expand Down