diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java
index 527d058853..58422353d9 100644
--- a/runelite-api/src/main/java/net/runelite/api/Client.java
+++ b/runelite-api/src/main/java/net/runelite/api/Client.java
@@ -1023,6 +1023,11 @@ public interface Client extends GameShell
*/
int getKeyboardIdleTicks();
+ /**
+ * Returns an array of booleans relating to keys pressed.
+ */
+ boolean[] getPressedKeys();
+
/**
* Changes how game behaves based on memory mode. Low memory mode skips
* drawing of all floors and renders ground textures in low quality.
@@ -1755,4 +1760,4 @@ public interface Client extends GameShell
* Returns the max item index + 1 from cache
*/
int getItemCount();
-}
+}
\ No newline at end of file
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java
index d5006a84ff..6c9be0b987 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java
@@ -30,6 +30,7 @@ package net.runelite.client.plugins.menuentryswapper;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
+import net.runelite.client.config.Keybind;
import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode;
import net.runelite.client.plugins.menuentryswapper.util.CharterOption;
import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode;
@@ -349,12 +350,24 @@ public interface MenuEntrySwapperConfig extends Config
// Miscellaneous
//------------------------------------------------------------//
+ @ConfigItem(
+ keyName = "hotkeyMod",
+ name = "Hotkey for Swaps",
+ description = "Set this hotkey to do custom swaps on hotkeys.",
+ position = 0,
+ group = "Miscellaneous"
+ )
+ default Keybind hotkeyMod()
+ {
+ return Keybind.SHIFT;
+ }
+
@ConfigItem(
keyName = "customSwaps",
name = "Custom Swaps",
description = "Add custom swaps here, 1 per line. Syntax: option,target:priority" +
"
Note that the higher your set the priority, the more it will overtake over swaps.",
- position = 0,
+ position = 1,
group = "Miscellaneous",
parse = true,
clazz = CustomSwapParse.class,
@@ -367,11 +380,11 @@ public interface MenuEntrySwapperConfig extends Config
@ConfigItem(
keyName = "shiftCustomSwaps",
- name = "Shift Swaps",
- description = "Add custom swaps here that will only be activated when you press shift." +
+ name = "Hotkey Swaps",
+ description = "Add custom swaps here that will only be activated when you press your hotkey." +
"
1 per line. Syntax: option,target:priority" +
"
Note that the higher your set the priority, the more it will overtake over swaps.",
- position = 1,
+ position = 2,
group = "Miscellaneous",
parse = true,
clazz = CustomSwapParse.class,
@@ -1734,4 +1747,4 @@ public interface MenuEntrySwapperConfig extends Config
{
return "cure other, energy transfer, heal other, vengeance other";
}
-}
+}
\ No newline at end of file
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java
index 7d6d812829..09efea9bb5 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java
@@ -44,14 +44,16 @@ import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
+import lombok.AccessLevel;
+import lombok.Setter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
+import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import static net.runelite.api.MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET;
import static net.runelite.api.MenuOpcode.WALK;
-import net.runelite.api.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.Player;
import net.runelite.api.Varbits;
@@ -60,12 +62,14 @@ import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.ConfigChanged;
+import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.VarbitChanged;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
+import net.runelite.client.config.Keybind;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.input.KeyManager;
import net.runelite.client.menus.AbstractComparableEntry;
@@ -99,6 +103,7 @@ import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
+import net.runelite.client.util.HotkeyListener;
import static net.runelite.client.util.MenuUtil.swap;
import net.runelite.client.util.MiscUtils;
import net.runelite.client.util.Text;
@@ -116,8 +121,10 @@ import org.apache.commons.lang3.ArrayUtils;
public class MenuEntrySwapperPlugin extends Plugin
{
private static final String CONFIG_GROUP = "shiftclick";
- private static final String SHIFT = "menuentryswapper shift";
+ private static final String HOTKEY = "menuentryswapper hotkey";
private static final String CONTROL = "menuentryswapper control";
+ private static final String HOTKEY_CHECK = "menuentryswapper hotkey check";
+ private static final String CONTROL_CHECK = "menuentryswapper control check";
private static final int PURO_PURO_REGION_ID = 10307;
private static final Set NPC_MENU_TYPES = ImmutableSet.of(
MenuOpcode.NPC_FIRST_OPTION, MenuOpcode.NPC_SECOND_OPTION, MenuOpcode.NPC_THIRD_OPTION,
@@ -141,8 +148,6 @@ public class MenuEntrySwapperPlugin extends Plugin
@Inject
private KeyManager keyManager;
@Inject
- private ShiftClickInputListener inputListener;
- @Inject
private EventBus eventBus;
@Inject
private PvpToolsPlugin pvpTools;
@@ -158,6 +163,10 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean buildingMode;
private boolean inTobRaid = false;
private boolean inCoxRaid = false;
+ @Setter(AccessLevel.PRIVATE)
+ private boolean hotkeyActive;
+ @Setter(AccessLevel.PRIVATE)
+ private boolean controlActive;
private final Map customSwaps = new HashMap<>();
private final Map customShiftSwaps = new HashMap<>();
private final Map dePrioSwaps = new HashMap<>();
@@ -286,6 +295,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean swapTrade;
private boolean swapTravel;
private boolean swapWildernessLever;
+ private Keybind hotkeyMod;
@Provides
MenuEntrySwapperConfig provideConfig(ConfigManager configManager)
@@ -302,7 +312,8 @@ public class MenuEntrySwapperPlugin extends Plugin
addSwaps();
loadConstructionItems();
loadCustomSwaps(config.customSwaps(), customSwaps);
- keyManager.registerKeyListener(inputListener);
+ keyManager.registerKeyListener(ctrlHotkey);
+ keyManager.registerKeyListener(hotkey);
if (client.getGameState() == GameState.LOGGED_IN)
{
setCastOptions(true);
@@ -316,7 +327,8 @@ public class MenuEntrySwapperPlugin extends Plugin
loadCustomSwaps("", customSwaps); // Removes all custom swaps
removeSwaps();
- keyManager.unregisterKeyListener(inputListener);
+ keyManager.unregisterKeyListener(ctrlHotkey);
+ keyManager.unregisterKeyListener(hotkey);
if (client.getGameState() == GameState.LOGGED_IN)
{
resetCastOptions();
@@ -330,6 +342,16 @@ public class MenuEntrySwapperPlugin extends Plugin
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(MenuOpened.class, this, this::onMenuOpened);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
+ eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
+ }
+
+ private void onFocusChanged(FocusChanged event)
+ {
+ if (!event.isFocused())
+ {
+ stopControl();
+ stopHotkey();
+ }
}
private void onConfigChanged(ConfigChanged event)
@@ -714,12 +736,19 @@ public class MenuEntrySwapperPlugin extends Plugin
private void addSwaps()
{
- final Map tmp = NEWLINE_SPLITTER.withKeyValueSeparator(',').split(config.prioEntry());
+ final List tmp = NEWLINE_SPLITTER.splitToList(config.prioEntry());
- for (Map.Entry str : tmp.entrySet())
+ for (String str : tmp)
{
- final AbstractComparableEntry a = newBaseComparableEntry("", str.getValue(), -1, -1, false, true);
- final AbstractComparableEntry b = newBaseComparableEntry(str.getKey(), "", -1, -1, false, false);
+ String[] strings = str.split(",");
+
+ if (strings.length <= 1)
+ {
+ continue;
+ }
+
+ final AbstractComparableEntry a = newBaseComparableEntry("", strings[1], -1, -1, false, true);
+ final AbstractComparableEntry b = newBaseComparableEntry(strings[0], "", -1, -1, false, false);
dePrioSwaps.put(a, b);
menuManager.addSwap(a, b);
}
@@ -1436,37 +1465,58 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
- void startShift()
+ private void startHotkey()
{
- eventBus.subscribe(ClientTick.class, SHIFT, this::addShift);
+ eventBus.subscribe(ClientTick.class, HOTKEY, this::addHotkey);
+ eventBus.subscribe(ClientTick.class, HOTKEY_CHECK, this::hotkeyCheck);
}
- private void addShift(ClientTick event)
+ private void addHotkey(ClientTick event)
{
loadCustomSwaps(this.configCustomShiftSwaps, customShiftSwaps);
- if (!this.swapClimbUpDown)
+ if (this.swapClimbUpDown)
{
- return;
+ menuManager.addPriorityEntry("climb-up").setPriority(100);
}
- menuManager.addPriorityEntry("climb-up").setPriority(100);
- eventBus.unregister(SHIFT);
+ eventBus.unregister(HOTKEY);
}
- void stopShift()
+ private void stopHotkey()
{
- eventBus.subscribe(ClientTick.class, SHIFT, this::remShift);
+ eventBus.subscribe(ClientTick.class, HOTKEY, this::removeHotkey);
}
- private void remShift(ClientTick event)
+ private void removeHotkey(ClientTick event)
{
menuManager.removePriorityEntry("climb-up");
loadCustomSwaps("", customShiftSwaps);
- eventBus.unregister(SHIFT);
+ eventBus.unregister(HOTKEY);
}
- void startControl()
+ private void hotkeyCheck(ClientTick event)
+ {
+ if (hotkeyActive)
+ {
+ int i = 0;
+ for (boolean bol : client.getPressedKeys())
+ {
+ if (bol)
+ {
+ i++;
+ }
+ }
+ if (i == 0)
+ {
+ stopHotkey();
+ setHotkeyActive(false);
+ eventBus.unregister(HOTKEY_CHECK);
+ }
+ }
+ }
+
+ private void startControl()
{
if (!this.swapClimbUpDown)
{
@@ -1474,6 +1524,7 @@ public class MenuEntrySwapperPlugin extends Plugin
}
eventBus.subscribe(ClientTick.class, CONTROL, this::addControl);
+ eventBus.subscribe(ClientTick.class, CONTROL_CHECK, this::controlCheck);
}
private void addControl(ClientTick event)
@@ -1482,17 +1533,38 @@ public class MenuEntrySwapperPlugin extends Plugin
eventBus.unregister(CONTROL);
}
- void stopControl()
+ private void stopControl()
{
- eventBus.subscribe(ClientTick.class, CONTROL, this::remControl);
+ eventBus.subscribe(ClientTick.class, CONTROL, this::removeControl);
}
- private void remControl(ClientTick event)
+ private void removeControl(ClientTick event)
{
menuManager.removePriorityEntry("climb-down");
eventBus.unregister(CONTROL);
}
+ private void controlCheck(ClientTick event)
+ {
+ if (controlActive)
+ {
+ int i = 0;
+ for (boolean bol : client.getPressedKeys())
+ {
+ if (bol)
+ {
+ i++;
+ }
+ }
+ if (i == 0)
+ {
+ stopControl();
+ setControlActive(false);
+ eventBus.unregister(CONTROL_CHECK);
+ }
+ }
+ }
+
private void setCastOptions(boolean force)
{
clientThread.invoke(() ->
@@ -1548,130 +1620,131 @@ public class MenuEntrySwapperPlugin extends Plugin
private void updateConfig()
{
- this.getWithdrawOne = config.getWithdrawOne();
- this.getWithdrawOneItems = config.getWithdrawOneItems();
+ this.charterOption = config.charterOption();
+ this.configCustomShiftSwaps = config.shiftCustomSwaps();
+ this.configCustomSwaps = config.customSwaps();
+ this.constructionCapeMode = config.constructionCapeMode();
+ this.getBurningAmulet = config.getBurningAmulet();
+ this.getBurningAmuletMode = config.getBurningAmuletMode();
+ this.getBuyFiftyItems = config.getBuyFiftyItems();
+ this.getBuyFiveItems = config.getBuyFiveItems();
+ this.getBuyOneItems = config.getBuyOneItems();
+ this.getBuyTenItems = config.getBuyTenItems();
+ this.getCombatBracelet = config.getCombatBracelet();
+ this.getCombatBraceletMode = config.getCombatBraceletMode();
+ this.getConstructionMode = config.getConstructionMode();
+ this.getDigsitePendant = config.getDigsitePendant();
+ this.getDigsitePendantMode = config.getDigsitePendantMode();
+ this.getDuelingRing = config.getDuelingRing();
+ this.getDuelingRingMode = config.getDuelingRingMode();
+ this.getEasyConstruction = config.getEasyConstruction();
+ this.getGamesNecklace = config.getGamesNecklace();
+ this.getGamesNecklaceMode = config.getGamesNecklaceMode();
+ this.getGlory = config.getGlory();
+ this.getGloryMode = config.getGloryMode();
+ this.getNecklaceofPassage = config.getNecklaceofPassage();
+ this.getNecklaceofPassageMode = config.getNecklaceofPassageMode();
+ this.getRemoveObjects = config.getRemoveObjects();
+ this.getRemovedObjects = config.getRemovedObjects();
+ this.getRingofWealth = config.getRingofWealth();
+ this.getRingofWealthMode = config.getRingofWealthMode();
+ this.getSellFiftyItems = config.getSellFiftyItems();
+ this.getSellFiveItems = config.getSellFiveItems();
+ this.getSellOneItems = config.getSellOneItems();
+ this.getSellTenItems = config.getSellTenItems();
+ this.getSkillsNecklace = config.getSkillsNecklace();
+ this.getSkillsNecklaceMode = config.getSkillsNecklaceMode();
+ this.getSlayerRing = config.getSlayerRing();
+ this.getSlayerRingMode = config.getSlayerRingMode();
+ this.getSwapArdougneCape = config.getSwapArdougneCape();
+ this.getSwapBuyFifty = config.getSwapBuyFifty();
+ this.getSwapBuyFive = config.getSwapBuyFive();
+ this.getSwapBuyOne = config.getSwapBuyOne();
+ this.getSwapBuyTen = config.getSwapBuyTen();
+ this.getSwapConstructionCape = config.getSwapConstructionCape();
+ this.getSwapCraftingCape = config.getSwapCraftingCape();
+ this.getSwapExplorersRing = config.getSwapExplorersRing();
+ this.getSwapMagicCape = config.getSwapMagicCape();
+ this.getSwapPuro = config.getSwapPuro();
+ this.getSwapSawmill = config.getSwapSawmill();
+ this.getSwapSawmillPlanks = config.getSwapSawmillPlanks();
+ this.getSwapSellFifty = config.getSwapSellFifty();
+ this.getSwapSellFive = config.getSwapSellFive();
+ this.getSwapSellOne = config.getSwapSellOne();
+ this.getSwapSellTen = config.getSwapSellTen();
+ this.getSwapTanning = config.getSwapTanning();
+ this.getWithdrawAll = config.getWithdrawAll();
+ this.getWithdrawAllItems = config.getWithdrawAllItems();
this.getWithdrawFive = config.getWithdrawFive();
this.getWithdrawFiveItems = config.getWithdrawFiveItems();
+ this.getWithdrawOne = config.getWithdrawOne();
+ this.getWithdrawOneItems = config.getWithdrawOneItems();
this.getWithdrawTen = config.getWithdrawTen();
this.getWithdrawTenItems = config.getWithdrawTenItems();
this.getWithdrawX = config.getWithdrawX();
this.getWithdrawXAmount = config.getWithdrawXAmount();
this.getWithdrawXItems = config.getWithdrawXItems();
- this.getWithdrawAll = config.getWithdrawAll();
- this.getWithdrawAllItems = config.getWithdrawAllItems();
- this.swapMax = config.swapMax();
- this.maxMode = config.maxMode();
- this.getSwapArdougneCape = config.getSwapArdougneCape();
- this.getSwapConstructionCape = config.getSwapConstructionCape();
- this.constructionCapeMode = config.constructionCapeMode();
- this.getSwapCraftingCape = config.getSwapCraftingCape();
- this.getSwapMagicCape = config.getSwapMagicCape();
- this.getSwapExplorersRing = config.getSwapExplorersRing();
- this.swapAdmire = config.swapAdmire();
- this.swapQuestCape = config.swapQuestCape();
- this.questCapeMode = config.questCapeMode();
- this.configCustomSwaps = config.customSwaps();
- this.configCustomShiftSwaps = config.shiftCustomSwaps();
- this.swapCoalBag = config.swapCoalBag();
- this.swapBirdhouseEmpty = config.swapBirdhouseEmpty();
- this.swapBones = config.swapBones();
- this.swapChase = config.swapChase();
- this.swapHarpoon = config.swapHarpoon();
- this.swapOccultMode = config.swapOccultMode();
- this.swapHomePortalMode = config.swapHomePortalMode();
- this.swapPrivate = config.swapPrivate();
- this.swapPick = config.swapPick();
- this.swapQuick = config.swapQuick();
- this.swapBoxTrap = config.swapBoxTrap();
- this.rockCake = config.rockCake();
- this.swapRogueschests = config.swapRogueschests();
- this.swapClimbUpDown = config.swapClimbUpDown();
- this.swapStun = config.swapStun();
- this.swapSearch = config.swapSearch();
- this.swapHardWoodGrove = config.swapHardWoodGrove();
- this.getRemoveObjects = config.getRemoveObjects();
- this.getRemovedObjects = config.getRemovedObjects();
- this.swapImps = config.swapImps();
- this.charterOption = config.charterOption();
- this.getSwapBuyOne = config.getSwapBuyOne();
- this.getBuyOneItems = config.getBuyOneItems();
- this.getSwapBuyFive = config.getSwapBuyFive();
- this.getBuyFiveItems = config.getBuyFiveItems();
- this.getSwapBuyTen = config.getSwapBuyTen();
- this.getBuyTenItems = config.getBuyTenItems();
- this.getSwapBuyFifty = config.getSwapBuyFifty();
- this.getBuyFiftyItems = config.getBuyFiftyItems();
- this.getSwapSellOne = config.getSwapSellOne();
- this.getSellOneItems = config.getSellOneItems();
- this.getSwapSellFive = config.getSwapSellFive();
- this.getSellFiveItems = config.getSellFiveItems();
- this.getSwapSellTen = config.getSwapSellTen();
- this.getSellTenItems = config.getSellTenItems();
- this.getSwapSellFifty = config.getSwapSellFifty();
- this.getSellFiftyItems = config.getSellFiftyItems();
- this.getEasyConstruction = config.getEasyConstruction();
- this.getSwapTanning = config.getSwapTanning();
- this.getSwapSawmill = config.getSwapSawmill();
- this.getSwapSawmillPlanks = config.getSwapSawmillPlanks();
- this.getSwapPuro = config.getSwapPuro();
- this.swapAssignment = config.swapAssignment();
- this.swapBankExchange = config.swapBankExchange();
- this.swapContract = config.swapContract();
- this.swapInteract = config.swapInteract();
- this.swapPickpocket = config.swapPickpocket();
- this.swapPay = config.swapPay();
- this.swapAbyssTeleport = config.swapAbyssTeleport();
- this.swapTrade = config.swapTrade();
- this.swapTravel = config.swapTravel();
- this.swapMinigame = config.swapMinigame();
- this.swapPlank = config.swapPlank();
- this.swapMetamorphosis = config.swapMetamorphosis();
- this.swapEnchant = config.swapEnchant();
- this.swapFairyRingMode = config.swapFairyRingMode();
- this.swapObeliskMode = config.swapObeliskMode();
- this.swapTeleportItem = config.swapTeleportItem();
- this.swapWildernessLever = config.swapWildernessLever();
- this.swapNexus = config.swapNexus();
- this.getGamesNecklace = config.getGamesNecklace();
- this.getGamesNecklaceMode = config.getGamesNecklaceMode();
- this.getDuelingRing = config.getDuelingRing();
- this.getDuelingRingMode = config.getDuelingRingMode();
- this.getGlory = config.getGlory();
- this.getGloryMode = config.getGloryMode();
- this.getSkillsNecklace = config.getSkillsNecklace();
- this.getSkillsNecklaceMode = config.getSkillsNecklaceMode();
- this.getNecklaceofPassage = config.getNecklaceofPassage();
- this.getNecklaceofPassageMode = config.getNecklaceofPassageMode();
- this.getDigsitePendant = config.getDigsitePendant();
- this.getDigsitePendantMode = config.getDigsitePendantMode();
- this.getCombatBracelet = config.getCombatBracelet();
- this.getCombatBraceletMode = config.getCombatBraceletMode();
- this.getBurningAmulet = config.getBurningAmulet();
- this.getBurningAmuletMode = config.getBurningAmuletMode();
- this.getConstructionMode = config.getConstructionMode();
this.getXericsTalisman = config.getXericsTalisman();
this.getXericsTalismanMode = config.getXericsTalismanMode();
- this.getRingofWealth = config.getRingofWealth();
- this.getRingofWealthMode = config.getRingofWealthMode();
- this.getSlayerRing = config.getSlayerRing();
- this.getSlayerRingMode = config.getSlayerRingMode();
- this.hideExamine = config.hideExamine();
- this.hideTradeWith = config.hideTradeWith();
- this.hideReport = config.hideReport();
- this.hideLookup = config.hideLookup();
- this.hideNet = config.hideNet();
this.hideBait = config.hideBait();
- this.hideDestroyRunepouch = config.hideDestroyRunepouch();
- this.hideDestroyCoalbag = config.hideDestroyCoalbag();
- this.hideDestroyHerbsack = config.hideDestroyHerbsack();
- this.hideDestroyBoltpouch = config.hideDestroyBoltpouch();
- this.hideDestroyLootingBag = config.hideDestroyLootingBag();
- this.hideDestroyGembag = config.hideDestroyGembag();
- this.hideDropRunecraftingPouch = config.hideDropRunecraftingPouch();
- this.hideCastToB = config.hideCastToB();
- this.hideCastIgnoredToB = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredToB().toLowerCase()));
this.hideCastCoX = config.hideCastCoX();
this.hideCastIgnoredCoX = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredCoX().toLowerCase()));
+ this.hideCastIgnoredToB = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredToB().toLowerCase()));
+ this.hideCastToB = config.hideCastToB();
+ this.hideDestroyBoltpouch = config.hideDestroyBoltpouch();
+ this.hideDestroyCoalbag = config.hideDestroyCoalbag();
+ this.hideDestroyGembag = config.hideDestroyGembag();
+ this.hideDestroyHerbsack = config.hideDestroyHerbsack();
+ this.hideDestroyLootingBag = config.hideDestroyLootingBag();
+ this.hideDestroyRunepouch = config.hideDestroyRunepouch();
+ this.hideDropRunecraftingPouch = config.hideDropRunecraftingPouch();
+ this.hideExamine = config.hideExamine();
+ this.hideLookup = config.hideLookup();
+ this.hideNet = config.hideNet();
+ this.hideReport = config.hideReport();
+ this.hideTradeWith = config.hideTradeWith();
+ this.hotkeyMod = config.hotkeyMod();
+ this.maxMode = config.maxMode();
+ this.questCapeMode = config.questCapeMode();
+ this.rockCake = config.rockCake();
+ this.swapAbyssTeleport = config.swapAbyssTeleport();
+ this.swapAdmire = config.swapAdmire();
+ this.swapAssignment = config.swapAssignment();
+ this.swapBankExchange = config.swapBankExchange();
+ this.swapBirdhouseEmpty = config.swapBirdhouseEmpty();
+ this.swapBones = config.swapBones();
+ this.swapBoxTrap = config.swapBoxTrap();
+ this.swapChase = config.swapChase();
+ this.swapClimbUpDown = config.swapClimbUpDown();
+ this.swapCoalBag = config.swapCoalBag();
+ this.swapContract = config.swapContract();
+ this.swapEnchant = config.swapEnchant();
+ this.swapFairyRingMode = config.swapFairyRingMode();
+ this.swapHardWoodGrove = config.swapHardWoodGrove();
+ this.swapHarpoon = config.swapHarpoon();
+ this.swapHomePortalMode = config.swapHomePortalMode();
+ this.swapImps = config.swapImps();
+ this.swapInteract = config.swapInteract();
+ this.swapMax = config.swapMax();
+ this.swapMetamorphosis = config.swapMetamorphosis();
+ this.swapMinigame = config.swapMinigame();
+ this.swapNexus = config.swapNexus();
+ this.swapObeliskMode = config.swapObeliskMode();
+ this.swapOccultMode = config.swapOccultMode();
+ this.swapPay = config.swapPay();
+ this.swapPick = config.swapPick();
+ this.swapPickpocket = config.swapPickpocket();
+ this.swapPlank = config.swapPlank();
+ this.swapPrivate = config.swapPrivate();
+ this.swapQuestCape = config.swapQuestCape();
+ this.swapQuick = config.swapQuick();
+ this.swapRogueschests = config.swapRogueschests();
+ this.swapSearch = config.swapSearch();
+ this.swapStun = config.swapStun();
+ this.swapTeleportItem = config.swapTeleportItem();
+ this.swapTrade = config.swapTrade();
+ this.swapTravel = config.swapTravel();
+ this.swapWildernessLever = config.swapWildernessLever();
}
/**
@@ -1757,4 +1830,38 @@ public class MenuEntrySwapperPlugin extends Plugin
.collect(Collectors.joining("\n"))
);
}
+
+ private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod)
+ {
+ @Override
+ public void hotkeyPressed()
+ {
+ startHotkey();
+ setHotkeyActive(true);
+ }
+
+ @Override
+ public void hotkeyReleased()
+ {
+ stopHotkey();
+ setHotkeyActive(false);
+ }
+ };
+
+ private final HotkeyListener ctrlHotkey = new HotkeyListener(() -> Keybind.CTRL)
+ {
+ @Override
+ public void hotkeyPressed()
+ {
+ startControl();
+ setControlActive(true);
+ }
+
+ @Override
+ public void hotkeyReleased()
+ {
+ stopControl();
+ setControlActive(false);
+ }
+ };
}
\ No newline at end of file
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java
index f3671256a9..63ca44de58 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java
@@ -25,8 +25,10 @@
package net.runelite.client.plugins.menuentryswapper;
import com.google.common.base.Splitter;
-import java.util.Map;
+import java.util.List;
+import javax.inject.Singleton;
+@Singleton
public class PrioParse
{
public static boolean parse(String value)
@@ -48,7 +50,17 @@ public class PrioParse
.omitEmptyStrings()
.trimResults();
- final Map tmp = NEWLINE_SPLITTER.withKeyValueSeparator(',').split(sb);
+ final List tmp = NEWLINE_SPLITTER.splitToList(sb);
+
+ for (String s : tmp)
+ {
+ final String[] strings = s.split(",");
+
+ if (strings.length <= 1)
+ {
+ return false;
+ }
+ }
return tmp.size() > 0;
}
@@ -57,4 +69,4 @@ public class PrioParse
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftClickInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftClickInputListener.java
deleted file mode 100644
index b1832defb4..0000000000
--- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/ShiftClickInputListener.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018, Kamiel
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package net.runelite.client.plugins.menuentryswapper;
-
-import java.awt.event.KeyEvent;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import net.runelite.client.input.KeyListener;
-
-@Singleton
-class ShiftClickInputListener implements KeyListener
-{
- @Inject
- private MenuEntrySwapperPlugin plugin;
-
- @Override
- public void keyTyped(KeyEvent event)
- {
- }
-
- @Override
- public void keyPressed(KeyEvent event)
- {
- if (event.getKeyCode() == KeyEvent.VK_SHIFT)
- {
- plugin.startShift();
- }
- if (event.getKeyCode() == KeyEvent.VK_CONTROL)
- {
- plugin.startControl();
- }
- }
-
- @Override
- public void keyReleased(KeyEvent event)
- {
- if (event.getKeyCode() == KeyEvent.VK_SHIFT)
- {
- plugin.stopShift();
- }
- if (event.getKeyCode() == KeyEvent.VK_CONTROL)
- {
- plugin.stopControl();
- }
- }
-}
diff --git a/runelite-client/src/main/java/net/runelite/client/util/HotkeyListener.java b/runelite-client/src/main/java/net/runelite/client/util/HotkeyListener.java
index 810f8dc386..42688718e0 100644
--- a/runelite-client/src/main/java/net/runelite/client/util/HotkeyListener.java
+++ b/runelite-client/src/main/java/net/runelite/client/util/HotkeyListener.java
@@ -73,6 +73,10 @@ public abstract class HotkeyListener implements KeyListener
{
if (keybind.get().matches(e))
{
+ if (isPressed)
+ {
+ hotkeyReleased();
+ }
isPressed = false;
isConsumingTyped = false;
}
@@ -81,4 +85,8 @@ public abstract class HotkeyListener implements KeyListener
public void hotkeyPressed()
{
}
+
+ public void hotkeyReleased()
+ {
+ }
}
diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java
index 9abf72604a..2e3c84cdf5 100644
--- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java
+++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java
@@ -29,11 +29,11 @@
package net.runelite.rs.api;
import java.math.BigInteger;
+import java.util.Map;
import net.runelite.api.Client;
import net.runelite.api.Sprite;
import net.runelite.api.World;
import net.runelite.api.widgets.Widget;
-import java.util.Map;
import net.runelite.mapping.Construct;
import net.runelite.mapping.Import;
@@ -597,6 +597,10 @@ public interface RSClient extends RSGameShell, Client
@Override
int getKeyboardIdleTicks();
+ @Import("KeyHandler_pressedKeys")
+ @Override
+ boolean[] getPressedKeys();
+
@Import("isLowDetail")
void setLowMemory(boolean lowMemory);
@@ -1046,4 +1050,4 @@ public interface RSClient extends RSGameShell, Client
@Import("ItemDefinition_fileCount")
int getItemCount();
-}
+}
\ No newline at end of file