Adds the option to remove the world map and special attack orbs to the (#645)
learn to click plugin Signed-off-by: PKLite <stonewall@pklite.xyz>
This commit is contained in:
@@ -74,4 +74,15 @@ public interface LearnToClickConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "hideOrbs",
|
||||
name = "Hide Orbs",
|
||||
description = "Completely hides the world map and special attack orbs"
|
||||
)
|
||||
default boolean hideOrbs()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,18 @@
|
||||
|
||||
package net.runelite.client.plugins.learntoclick;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
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.ConfigChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuShouldLeftClick;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
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.plugins.Plugin;
|
||||
@@ -36,6 +41,9 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
@Slf4j
|
||||
public class LearnToClickPlugin extends Plugin
|
||||
{
|
||||
private static final ImmutableList<WidgetInfo> ORB_WIDGETS = ImmutableList.of(WidgetInfo.MINIMAP_WORLDMAP_ORB,
|
||||
WidgetInfo.MINIMAP_SPEC_ORB);
|
||||
|
||||
@Inject
|
||||
private LearnToClickConfig config;
|
||||
private boolean forceRightClickFlag;
|
||||
@@ -51,13 +59,44 @@ public class LearnToClickPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
forceRightClickFlag = false;
|
||||
hideOrbWidgets(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("learntoclick") && !event.getKey().equals("hideOrbs"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (config.hideOrbs())
|
||||
{
|
||||
hideOrbWidgets(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hideOrbWidgets(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (!config.hideOrbs())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.getGroupId() == WidgetID.MINIMAP_GROUP_ID)
|
||||
{
|
||||
hideOrbWidgets(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -71,7 +110,10 @@ public class LearnToClickPlugin extends Plugin
|
||||
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()))
|
||||
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;
|
||||
@@ -82,7 +124,9 @@ public class LearnToClickPlugin extends Plugin
|
||||
@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()))
|
||||
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;
|
||||
}
|
||||
@@ -99,6 +143,14 @@ public class LearnToClickPlugin extends Plugin
|
||||
}
|
||||
client.setMenuEntries(entries);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles hiding the World map and special attack orb widgets
|
||||
* @param hidden - hides the Widgets if true, un-hides them if false
|
||||
*/
|
||||
private void hideOrbWidgets(boolean hidden)
|
||||
{
|
||||
ORB_WIDGETS.forEach(widgetInfo -> client.getWidget(widgetInfo).setHidden(hidden));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user