Refactor WarIndicators
This commit is contained in:
@@ -34,10 +34,10 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface WarIndicatorConfig extends Config
|
public interface WarIndicatorConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 0,
|
position = 0,
|
||||||
keyName = "highLightCallers",
|
keyName = "highLightCallers",
|
||||||
name = "Highlight Callers",
|
name = "Highlight Callers",
|
||||||
description = "Highlight listed caller(s)"
|
description = "Highlight listed caller(s)"
|
||||||
)
|
)
|
||||||
default boolean highLightCallers()
|
default boolean highLightCallers()
|
||||||
{
|
{
|
||||||
@@ -45,10 +45,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 1,
|
position = 1,
|
||||||
keyName = "callerColor",
|
keyName = "callerColor",
|
||||||
name = "Caller(s) Color",
|
name = "Caller(s) Color",
|
||||||
description = "Color to highlight caller's name"
|
description = "Color to highlight caller's name"
|
||||||
)
|
)
|
||||||
default Color getCallerColor()
|
default Color getCallerColor()
|
||||||
{
|
{
|
||||||
@@ -56,10 +56,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 2,
|
position = 2,
|
||||||
keyName = "callerMinimap",
|
keyName = "callerMinimap",
|
||||||
name = "Callers on Minimap",
|
name = "Callers on Minimap",
|
||||||
description = "Show your caller(s) on the minimap"
|
description = "Show your caller(s) on the minimap"
|
||||||
)
|
)
|
||||||
default boolean callerMinimap()
|
default boolean callerMinimap()
|
||||||
{
|
{
|
||||||
@@ -68,10 +68,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 3,
|
position = 3,
|
||||||
keyName = "callerTile",
|
keyName = "callerTile",
|
||||||
name = "Show Caller's Tile",
|
name = "Show Caller's Tile",
|
||||||
description = "Show the tile your target is standing on"
|
description = "Show the tile your target is standing on"
|
||||||
)
|
)
|
||||||
default boolean callerTile()
|
default boolean callerTile()
|
||||||
{
|
{
|
||||||
@@ -79,10 +79,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 4,
|
position = 4,
|
||||||
keyName = "activeCallers",
|
keyName = "activeCallers",
|
||||||
name = "Callers",
|
name = "Callers",
|
||||||
description = "Adds a user to your caller list. Format: (caller), (caller)"
|
description = "Adds a user to your caller list. Format: (caller), (caller)"
|
||||||
)
|
)
|
||||||
default String getActiveCallers()
|
default String getActiveCallers()
|
||||||
{
|
{
|
||||||
@@ -90,19 +90,19 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
position = 5,
|
||||||
keyName = "activeCallers",
|
keyName = "activeCallers",
|
||||||
name = "",
|
name = "",
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
void setActiveCallers(String key);
|
void setActiveCallers(String key);
|
||||||
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 6,
|
position = 6,
|
||||||
keyName = "highlightSnipes",
|
keyName = "highlightSnipes",
|
||||||
name = "Highlight Targets",
|
name = "Highlight Targets",
|
||||||
description = "Highlight listed target(s)"
|
description = "Highlight listed target(s)"
|
||||||
)
|
)
|
||||||
default boolean highlightSnipes()
|
default boolean highlightSnipes()
|
||||||
{
|
{
|
||||||
@@ -110,10 +110,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 7,
|
position = 7,
|
||||||
keyName = "snipeColor",
|
keyName = "snipeColor",
|
||||||
name = "Target(s) Color",
|
name = "Target(s) Color",
|
||||||
description = "Color to highlight target name"
|
description = "Color to highlight target name"
|
||||||
)
|
)
|
||||||
default Color getSnipeColor()
|
default Color getSnipeColor()
|
||||||
{
|
{
|
||||||
@@ -121,10 +121,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 8,
|
position = 8,
|
||||||
keyName = "snipeMinimap",
|
keyName = "snipeMinimap",
|
||||||
name = "Targets on Minimap",
|
name = "Targets on Minimap",
|
||||||
description = "Show your target on the minimap"
|
description = "Show your target on the minimap"
|
||||||
)
|
)
|
||||||
default boolean snipeMinimap()
|
default boolean snipeMinimap()
|
||||||
{
|
{
|
||||||
@@ -132,10 +132,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 9,
|
position = 9,
|
||||||
keyName = "snipeTile",
|
keyName = "snipeTile",
|
||||||
name = "Show Target's Tile",
|
name = "Show Target's Tile",
|
||||||
description = "Show the tile your target is standing on"
|
description = "Show the tile your target is standing on"
|
||||||
)
|
)
|
||||||
default boolean snipeTile()
|
default boolean snipeTile()
|
||||||
{
|
{
|
||||||
@@ -143,10 +143,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 10,
|
position = 10,
|
||||||
keyName = "targetedSnipes",
|
keyName = "targetedSnipes",
|
||||||
name = "Targets",
|
name = "Targets",
|
||||||
description = "Adds a user to your snipe list. Format: (target), (target)"
|
description = "Adds a user to your snipe list. Format: (target), (target)"
|
||||||
)
|
)
|
||||||
default String getTargetedSnipes()
|
default String getTargetedSnipes()
|
||||||
{
|
{
|
||||||
@@ -154,11 +154,10 @@ public interface WarIndicatorConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 11,
|
position = 11,
|
||||||
keyName = "targetedSnipes",
|
keyName = "targetedSnipes",
|
||||||
name = "",
|
name = "",
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
void setTargetedSnipe(String key);
|
void setTargetedSnipe(String key);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,6 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
@@ -38,6 +37,7 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WarIndicatorOverlay extends Overlay
|
public class WarIndicatorOverlay extends Overlay
|
||||||
|
|||||||
@@ -24,43 +24,28 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.warindicators;
|
package net.runelite.client.plugins.warindicators;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.Collection;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import net.runelite.client.plugins.PluginType;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import static net.runelite.api.MenuAction.FOLLOW;
|
import static net.runelite.api.MenuAction.*;
|
||||||
import static net.runelite.api.MenuAction.ITEM_USE_ON_PLAYER;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_EIGTH_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_FIFTH_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_FIRST_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_FOURTH_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_SECOND_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
|
|
||||||
import static net.runelite.api.MenuAction.SPELL_CAST_ON_PLAYER;
|
|
||||||
import static net.runelite.api.MenuAction.TRADE;
|
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "War calling indicators",
|
name = "War calling indicators",
|
||||||
description = "War War War.",
|
description = "War War War.",
|
||||||
tags = {"skill", "total", "max", "PVP"},
|
tags = {"skill", "total", "max", "PVP"},
|
||||||
type = PluginType.PVP,
|
type = PluginType.PVP,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
public class WarIndicatorPlugin extends Plugin
|
public class WarIndicatorPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@@ -85,19 +70,19 @@ public class WarIndicatorPlugin extends Plugin
|
|||||||
return configManager.getConfig(WarIndicatorConfig.class);
|
return configManager.getConfig(WarIndicatorConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.add(warIndicatorOverlay);
|
overlayManager.add(warIndicatorOverlay);
|
||||||
overlayManager.add(warIndicatorMiniMapOverlay);
|
overlayManager.add(warIndicatorMiniMapOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(warIndicatorOverlay);
|
overlayManager.remove(warIndicatorOverlay);
|
||||||
overlayManager.remove(warIndicatorMiniMapOverlay);
|
overlayManager.remove(warIndicatorMiniMapOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdd(MenuEntryAdded menuEntryAdded)
|
public void onMenuEntryAdd(MenuEntryAdded menuEntryAdded)
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.warindicators;
|
package net.runelite.client.plugins.warindicators;
|
||||||
|
|
||||||
import net.runelite.api.Client;
|
import java.awt.Color;
|
||||||
import net.runelite.api.Player;
|
import java.util.function.BiConsumer;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import java.awt.*;
|
import net.runelite.api.Client;
|
||||||
import java.util.function.BiConsumer;
|
import net.runelite.api.Player;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WarIndicatorService
|
public class WarIndicatorService
|
||||||
@@ -62,14 +62,9 @@ public class WarIndicatorService
|
|||||||
|
|
||||||
String[] targets = config.getTargetedSnipes().split(", ");
|
String[] targets = config.getTargetedSnipes().split(", ");
|
||||||
|
|
||||||
if (targets == null)
|
for (String target : targets)
|
||||||
{
|
{
|
||||||
return;
|
if (player.getName().equalsIgnoreCase(target))
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < targets.length; i++)
|
|
||||||
{
|
|
||||||
if (player.getName().equalsIgnoreCase(targets[i]))
|
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getSnipeColor());
|
consumer.accept(player, config.getSnipeColor());
|
||||||
}
|
}
|
||||||
@@ -88,14 +83,9 @@ public class WarIndicatorService
|
|||||||
|
|
||||||
String[] callers = config.getActiveCallers().split(", ");
|
String[] callers = config.getActiveCallers().split(", ");
|
||||||
|
|
||||||
if (callers == null)
|
for (String caller : callers)
|
||||||
{
|
{
|
||||||
return;
|
if (player.getName().equalsIgnoreCase(caller))
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < callers.length; i++)
|
|
||||||
{
|
|
||||||
if (player.getName().equalsIgnoreCase(callers[i]))
|
|
||||||
{
|
{
|
||||||
consumer.accept(player, config.getCallerColor());
|
consumer.accept(player, config.getCallerColor());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user