bank: add option to force right click on deposit container buttons
This commit is contained in:
@@ -64,4 +64,37 @@ public interface BankConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "rightClickBankInventory",
|
||||||
|
name = "Disable left click bank inventory",
|
||||||
|
description = "Configures whether the bank inventory button will bank your inventory on left click",
|
||||||
|
position = 4
|
||||||
|
)
|
||||||
|
default boolean rightClickBankInventory()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "rightClickBankEquip",
|
||||||
|
name = "Disable left click bank equipment",
|
||||||
|
description = "Configures whether the bank equipment button will bank your equipment on left click",
|
||||||
|
position = 5
|
||||||
|
)
|
||||||
|
default boolean rightClickBankEquip()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "rightClickBankLoot",
|
||||||
|
name = "Disable left click bank looting bag",
|
||||||
|
description = "Configures whether the bank looting bag button will bank your looting bag contents on left click",
|
||||||
|
position = 6
|
||||||
|
)
|
||||||
|
default boolean rightClickBankLoot()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, TheLonelyDev <https://github.com/TheLonelyDev>
|
* Copyright (c) 2018, TheLonelyDev <https://github.com/TheLonelyDev>
|
||||||
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
|
* Copyright (c) 2018, Jeremy Plsek <https://github.com/jplsek>
|
||||||
|
* Copyright (c) 2019, Hydrox6 <ikada@protonmail.ch>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -28,6 +29,9 @@ package net.runelite.client.plugins.bank;
|
|||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.api.events.MenuShouldLeftClick;
|
||||||
import net.runelite.api.events.ScriptCallbackEvent;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
@@ -44,6 +48,10 @@ import net.runelite.client.util.StackFormatter;
|
|||||||
)
|
)
|
||||||
public class BankPlugin extends Plugin
|
public class BankPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final String DEPOSIT_WORN = "Deposit worn items";
|
||||||
|
private static final String DEPOSIT_INVENTORY = "Deposit inventory";
|
||||||
|
private static final String DEPOSIT_LOOT = "Deposit loot";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -59,6 +67,8 @@ public class BankPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private BankSearch bankSearch;
|
private BankSearch bankSearch;
|
||||||
|
|
||||||
|
private boolean forceRightClickFlag;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
BankConfig getConfig(ConfigManager configManager)
|
BankConfig getConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -69,6 +79,40 @@ public class BankPlugin extends Plugin
|
|||||||
protected void shutDown()
|
protected void shutDown()
|
||||||
{
|
{
|
||||||
clientThread.invokeLater(() -> bankSearch.reset(false));
|
clientThread.invokeLater(() -> bankSearch.reset(false));
|
||||||
|
forceRightClickFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMenuShouldLeftClick(MenuShouldLeftClick event)
|
||||||
|
{
|
||||||
|
if (!forceRightClickFlag)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
forceRightClickFlag = false;
|
||||||
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
|
for (MenuEntry entry : menuEntries)
|
||||||
|
{
|
||||||
|
if ((entry.getOption().equals(DEPOSIT_WORN) && config.rightClickBankEquip())
|
||||||
|
|| (entry.getOption().equals(DEPOSIT_INVENTORY) && config.rightClickBankInventory())
|
||||||
|
|| (entry.getOption().equals(DEPOSIT_LOOT) && config.rightClickBankLoot()))
|
||||||
|
{
|
||||||
|
event.setForceRightClick(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
|
{
|
||||||
|
if ((event.getOption().equals(DEPOSIT_WORN) && config.rightClickBankEquip())
|
||||||
|
|| (event.getOption().equals(DEPOSIT_INVENTORY) && config.rightClickBankInventory())
|
||||||
|
|| (event.getOption().equals(DEPOSIT_LOOT) && config.rightClickBankLoot()))
|
||||||
|
{
|
||||||
|
forceRightClickFlag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
Reference in New Issue
Block a user