diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java index c22ce8215b..8568fa9da0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java @@ -110,6 +110,7 @@ public class AmmoPlugin extends Plugin if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx()) { + removeInfobox(); return; } @@ -118,8 +119,7 @@ public class AmmoPlugin extends Plugin if (!comp.isStackable()) { - infoBoxManager.removeInfoBox(counterBox); - counterBox = null; + removeInfobox(); return; } @@ -139,4 +139,10 @@ public class AmmoPlugin extends Plugin counterBox = new AmmoCounter(this, item.getId(), item.getQuantity(), comp.getName(), image); infoBoxManager.addInfoBox(counterBox); } + + private void removeInfobox() + { + infoBoxManager.removeInfoBox(counterBox); + counterBox = null; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java index 1cb5679498..03aa7c2110 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java @@ -62,6 +62,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener private static final String CLEAR_HISTORY = "Clear history"; private static final String CLEAR_PRIVATE = "Private:"; private static final int CYCLE_HOTKEY = KeyEvent.VK_TAB; + private static final int FRIENDS_MAX_SIZE = 5; private Queue messageQueue; private Deque friends; @@ -91,7 +92,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener protected void startUp() { messageQueue = EvictingQueue.create(100); - friends = new ArrayDeque<>(5); + friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1); keyManager.registerKeyListener(this); } @@ -134,7 +135,14 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener case MODPRIVATECHAT: final String name = Text.removeTags(chatMessage.getName()); // Remove to ensure uniqueness & its place in history - friends.remove(name); + if (!friends.remove(name)) + { + // If the friend didn't previously exist ensure deque capacity doesn't increase by adding them + if (friends.size() >= FRIENDS_MAX_SIZE) + { + friends.remove(); + } + } friends.add(name); // intentional fall-through case PUBLICCHAT: @@ -168,6 +176,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener { messageQueue.removeIf(e -> e.getType() == ChatMessageType.PRIVATECHAT || e.getType() == ChatMessageType.PRIVATECHATOUT || e.getType() == ChatMessageType.MODPRIVATECHAT); + friends.clear(); } else { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index d39203863a..de15266d70 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -94,6 +94,8 @@ public class InterfaceStylesPlugin extends Plugin removeGameframe(); healthBarOverride = null; client.setHealthBarOverride(null); + NodeCache heathBarCache = client.getHealthBarCache(); + heathBarCache.reset(); // invalidate healthbar cache so padding resets }); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java new file mode 100644 index 0000000000..fc612754d9 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * 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.learntoclick; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("learntoclick") +public interface LearnToClickConfig extends Config +{ + + @ConfigItem(position = 1, keyName = "blockCompass", name = "Compass", description = "Prevents the camera from moving when you misclick on the compass") + default boolean shouldBlockCompass() + { + return false; + } + + @ConfigItem(position = 2, keyName = "rightClickMap", name = "World Map", description = "Prevents the world map from opening on left click without disabling it entirely") + default boolean shouldRightClickMap() + { + return false; + } + + @ConfigItem(position = 3, keyName = "rightClickXp", name = "Xp Drops Toggle", description = "Prevents toggling xp drops on left click without disabling the toggle function entirely") + default boolean shouldRightClickXp() + { + return false; + } + + @ConfigItem(position = 4, keyName = "rightClickRetaliate", name = "Auto Retaliate", description = "Prevents toggling auto retaliate on left click without disabling the toggle function entirely") + default boolean shouldRightClickRetaliate() + { + return false; + } + + +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java new file mode 100644 index 0000000000..98e7224148 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2019. PKLite - All Rights Reserved + * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. + * Proprietary and confidential. Refer to PKLite License file for more information on + * full terms of this copyright and to determine what constitutes authorized use. + * Written by PKLite(ST0NEWALL, others) , 2019 + * + * Plugin by Tom C (@tomcylke on GitHub) + */ + +package net.runelite.client.plugins.learntoclick; + +import com.google.inject.Provides; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +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.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginType; +import org.apache.commons.lang3.ArrayUtils; + + +@PluginDescriptor( + name = "Learn to Click", + description = "A few modifications to prevent misclicks", + tags = {"pk", "misclick", "compass", "map", "auto retaliate"}, + type = PluginType.PVP, + enabledByDefault = false +) +@Slf4j +public class LearnToClickPlugin extends Plugin +{ + @Inject + private LearnToClickConfig config; + private boolean forceRightClickFlag; + private MenuEntry[] entries; + @Inject + private Client client; + + @Provides + LearnToClickConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(LearnToClickConfig.class); + } + + @Override + protected void startUp() throws Exception + { + + } + + @Override + protected void shutDown() throws Exception + { + 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("Floating") && config.shouldRightClickMap()) || (entry.getOption().equals("Hide") && config.shouldRightClickXp()) || (entry.getOption().equals("Show") && config.shouldRightClickXp()) || (entry.getOption().equals("Auto retaliate") && config.shouldRightClickRetaliate())) + { + event.setForceRightClick(true); + return; + } + } + } + + @Subscribe + public void onMenuEntryAdded(MenuEntryAdded event) + { + if ((event.getOption().equals("Floating") && config.shouldRightClickMap()) || (event.getOption().equals("Hide") && config.shouldRightClickXp()) || (event.getOption().equals("Show") && config.shouldRightClickXp()) || (event.getOption().equals("Auto retaliate") && config.shouldRightClickRetaliate())) + { + forceRightClickFlag = true; + } + entries = client.getMenuEntries(); + if (config.shouldBlockCompass()) + { + for (int i = entries.length - 1; i >= 0; i--) + { + if (entries[i].getOption().equals("Look North")) + { + entries = ArrayUtils.remove(entries, i); + i--; + } + } + client.setMenuEntries(entries); + } + + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java index 2a30494bf4..2c1b3c4cbb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java @@ -80,8 +80,10 @@ public class PlayerIndicatorsOverlay extends Overlay String playerInfo = ""; Point minimapLocation = actor.getMinimapLocation(); - graphics.fillOval(minimapLocation.getX() - 1, minimapLocation.getY() - 1, 2, 2); - + if (minimapLocation != null) + { + graphics.fillOval(minimapLocation.getX() - 1, minimapLocation.getY() - 1, 2, 2); + } if (config.drawOverheadPlayerNames()) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java index 70acbcba06..69725f6d1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java @@ -129,7 +129,7 @@ enum Task MOLANISKS("Molanisks", ItemID.MOLANISK), MONKEYS("Monkeys", ItemID.ENSOULED_MONKEY_HEAD), MOSS_GIANTS("Moss giants", ItemID.HILL_GIANT_CLUB), - MUTATED_ZYGOMITES("Mutated zygomites", ItemID.MUTATED_ZYGOMITE, 0, ItemID.FUNGICIDE_SPRAY_0, "Zygomite", "Fungi"), + MUTATED_ZYGOMITES("Mutated zygomites", ItemID.MUTATED_ZYGOMITE, 7, ItemID.FUNGICIDE_SPRAY_0, "Zygomite", "Fungi"), NECHRYAEL("Nechryael", ItemID.NECHRYAEL, "Nechryarch"), OGRES("Ogres", ItemID.ENSOULED_OGRE_HEAD), OTHERWORLDLY_BEING("Otherworldly beings", ItemID.GHOSTLY_HOOD), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderConfig.java deleted file mode 100644 index da657fdee1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.worldmaphider; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("worldMapHider") -public interface WorldMapHiderConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "hideWorldMapButton", - name = "Hide World Map Button", - description = "Hides the world map button. Prevents missclicks that open the world map" - ) - default boolean hideWorldMapButton() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderPlugin.java deleted file mode 100644 index 1f0b324a2a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmaphider/WorldMapHiderPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.worldmaphider; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Hide Worldmap Button", - description = "Hides the world map button", - type = PluginType.UTILITY, - tags = {"world", "world map", "hide", "button", "map", "hide world map", "pklite"} -) -public class WorldMapHiderPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private MenuManager menuManager; - - @Inject - private WorldMapHiderConfig config; - - @Inject - private ConfigManager configManager; - - private WidgetMenuOption hideWidgetMenuOption = new WidgetMenuOption("Hide Map Button", - "Hide Map Button", WidgetInfo.WORLD_MAP_OPTION); - - private ImmutableList widgetList = - ImmutableList.of(WidgetInfo.WORLD_MAP_OPTION, WidgetInfo.WORLD_MAP_BUTTON_BORDER, - WidgetInfo.MINIMAP_WORLD_ORB); - - @Provides - WorldMapHiderConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WorldMapHiderConfig.class); - } - - @Override - protected void startUp() - { - menuManager.addManagedCustomMenu(hideWidgetMenuOption); - } - - @Override - protected void shutDown() throws Exception - { - if (config.hideWorldMapButton()) - { - setMapHidden(false); - } - menuManager.removeManagedCustomMenu(hideWidgetMenuOption); - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (config.hideWorldMapButton()) - { - setMapHidden(true); - } - if (!config.hideWorldMapButton()) - { - setMapHidden(false); - } - } - - @Subscribe - public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getMenuOption().equals("Hide Map Button")) - { - configManager.setConfiguration("worldMapHider", "hideWorldMapButton", true); - } - } - - @Subscribe - public void onWidgetLoaded(WidgetLoaded event) - { - if (config.hideWorldMapButton() && event.getGroupId() == WidgetID.MINIMAP_GROUP_ID) - { - setMapHidden(true); - } - } - - private void setMapHidden(Boolean hidden) - { - if (widgetList.size() > 0) - widgetList.forEach(widgetInfo -> - { - if (widgetInfo != null && client.getWidget(widgetInfo) != null) - { - client.getWidget(widgetInfo).setHidden(hidden); - } - }); - } - -}