diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ClimbPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ClimbPlugin.java deleted file mode 100644 index 4bc899a5e4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ClimbPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -package net.runelite.client.plugins.climbupclimbdown; - -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Climb Up Climb Down", - description = "Hold Shift to Climb up, Ctrl to Climb down", - tags = {"climb", "stairs", "ladder", "swap", "key", "input"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class ClimbPlugin extends Plugin -{ - - @Inject - Client client; - - @Inject - KeyManager keyManager; - - @Inject - ShiftCtrlInputListener inputListener; - - @Getter - @Setter - private boolean isHoldingShift; - - @Getter - @Setter - private boolean isHoldingCtrl; - - @Override - protected void startUp() throws Exception - { - enableCustomization(); - } - - @Override - protected void shutDown() throws Exception - { - disableCustomization(); - } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) - { - try - { - if (menuEntryAdded.getOption().equalsIgnoreCase("climb")) - { - if (isHoldingCtrl ^ isHoldingShift) - { - if (isHoldingShift) - { - stripExceptFor("climb-up"); - } - if (isHoldingCtrl) - { - stripExceptFor("climb-down"); - } - } - } - } - catch (Exception e) - { - log.error("Uh oh!", e); - } - } - - - private void enableCustomization() - { - keyManager.registerKeyListener(inputListener); - } - - private void disableCustomization() - { - keyManager.unregisterKeyListener(inputListener); - } - - private void stripExceptFor(String option) - { - MenuEntry[] newEntries = new MenuEntry[1]; - - for (MenuEntry entry : client.getMenuEntries()) - { - if (entry.getOption().equalsIgnoreCase(option)) - { - newEntries[0] = entry; - } - } - - if (newEntries[0] != null) - { - client.setMenuEntries(newEntries); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ShiftCtrlInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ShiftCtrlInputListener.java deleted file mode 100644 index 4535c116ba..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/climbupclimbdown/ShiftCtrlInputListener.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.runelite.client.plugins.climbupclimbdown; - -import java.awt.event.KeyEvent; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.input.KeyListener; - -@Slf4j -public class ShiftCtrlInputListener implements KeyListener -{ - @Inject - ClimbPlugin plugin; - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - switch (e.getKeyCode()) - { - case KeyEvent.VK_SHIFT: - if (plugin.isHoldingShift()) - { - return; - } - plugin.setHoldingShift(true); - break; - case KeyEvent.VK_CONTROL: - if (plugin.isHoldingCtrl()) - { - return; - } - plugin.setHoldingCtrl(true); - break; - } - } - - @Override - public void keyReleased(KeyEvent e) - { - switch (e.getKeyCode()) - { - case KeyEvent.VK_SHIFT: - if (!plugin.isHoldingShift()) - { - return; - } - plugin.setHoldingShift(false); - break; - case KeyEvent.VK_CONTROL: - if (!plugin.isHoldingCtrl()) - { - return; - } - plugin.setHoldingCtrl(false); - break; - } - } -} 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 fbfe53c822..f1a39f4427 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 @@ -302,4 +302,14 @@ public interface MenuEntrySwapperConfig extends Config { return true; } + + @ConfigItem( + keyName = "swapClimbUpDown", + name = "Climb", + description = "Swap Climb-Up/Down depending on Shift or Control key " + ) + default boolean swapClimbUpDown() + { + return false; + } } 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 8f553a61ce..155795761d 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 @@ -131,6 +131,9 @@ public class MenuEntrySwapperPlugin extends Plugin @Setter private boolean shiftModifier = false; + @Setter + private boolean controlModifier = false; + @Provides MenuEntrySwapperConfig provideConfig(ConfigManager configManager) { @@ -452,6 +455,20 @@ public class MenuEntrySwapperPlugin extends Plugin } } + else if (option.equalsIgnoreCase("climb") && config.swapClimbUpDown()) + { + if (controlModifier ^ shiftModifier) + { + if (shiftModifier) + { + swap(client, "climb-up", option, target, true); + } + if (controlModifier) + { + swap(client, "climb-down", option, target, true); + } + } + } else if (config.swapTravel() && option.equals("pass") && target.equals("energy barrier")) { swap(client, "pay-toll(2-ecto)", option, target, true); 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 index f7dde77e00..cea447b527 100644 --- 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 @@ -54,6 +54,10 @@ public class ShiftClickInputListener implements KeyListener { plugin.setShiftModifier(true); } + if (event.getKeyCode() == KeyEvent.VK_CONTROL) + { + plugin.setControlModifier(true); + } } @Override @@ -63,5 +67,9 @@ public class ShiftClickInputListener implements KeyListener { plugin.setShiftModifier(false); } + if (event.getKeyCode() == KeyEvent.VK_CONTROL) + { + plugin.setControlModifier(false); + } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterConfig.java index a08f012e7a..ef349f58d1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterConfig.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2018, James Munson + * 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 HOLDER 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.tickcounter; import java.awt.Color; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterOverlay.java index 397392ad8c..2a05b06833 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterOverlay.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2018, James Munson + * 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 HOLDER 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.tickcounter; import java.awt.Dimension; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterPlugin.java index fd4a8a935a..11c9d349d6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tickcounter/TickCounterPlugin.java @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2018, James Munson + * 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 HOLDER 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.tickcounter; import com.google.inject.Provides;