warindicators: remove (#2288)
plugin is intergrated in player indicators
This commit is contained in:
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* 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.warindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("warIndicators")
|
||||
|
||||
public interface WarIndicatorConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "highLightCallers",
|
||||
name = "Highlight Callers",
|
||||
description = "Highlight listed caller(s)"
|
||||
)
|
||||
default boolean highLightCallers()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "callerColor",
|
||||
name = "Caller(s) Color",
|
||||
description = "Color to highlight caller's name"
|
||||
)
|
||||
default Color getCallerColor()
|
||||
{
|
||||
return new Color(36, 255, 237);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "callerMinimap",
|
||||
name = "Callers on Minimap",
|
||||
description = "Show your caller(s) on the minimap"
|
||||
)
|
||||
default boolean callerMinimap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "callerTile",
|
||||
name = "Show Caller's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
)
|
||||
default boolean callerTile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "activeCallers",
|
||||
name = "Callers",
|
||||
description = "Adds a user to your caller list. Format: (caller), (caller)"
|
||||
)
|
||||
default String getActiveCallers()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "activeCallers",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void setActiveCallers(String key);
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "highlightSnipes",
|
||||
name = "Highlight Targets",
|
||||
description = "Highlight listed target(s)"
|
||||
)
|
||||
default boolean highlightSnipes()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "snipeColor",
|
||||
name = "Target(s) Color",
|
||||
description = "Color to highlight target name"
|
||||
)
|
||||
default Color getSnipeColor()
|
||||
{
|
||||
return new Color(255, 0, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "snipeMinimap",
|
||||
name = "Targets on Minimap",
|
||||
description = "Show your target on the minimap"
|
||||
)
|
||||
default boolean snipeMinimap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "snipeTile",
|
||||
name = "Show Target's Tile",
|
||||
description = "Show the tile your target is standing on"
|
||||
)
|
||||
default boolean snipeTile()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "targetedSnipes",
|
||||
name = "Targets",
|
||||
description = "Adds a user to your snipe list. Format: (target), (target)"
|
||||
)
|
||||
default String getTargetedSnipes()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "targetedSnipes",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void setTargetedSnipe(String key);
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* 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.warindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@Singleton
|
||||
public class WarIndicatorMiniMapOverlay extends Overlay
|
||||
{
|
||||
private final WarIndicatorService warIndicatorService;
|
||||
private final WarIndicatorPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorMiniMapOverlay(final WarIndicatorPlugin plugin, final WarIndicatorService warIndicatorService)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.warIndicatorService = warIndicatorService;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
warIndicatorService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color));
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
||||
{
|
||||
final String name = actor.getName().replace('\u00A0', ' ');
|
||||
final net.runelite.api.Point minimapLocation = actor.getMinimapLocation();
|
||||
|
||||
String[] callers = plugin.getGetActiveCallers().split(", ");
|
||||
String[] targets = plugin.getGetTargetedSnipes().split(", ");
|
||||
|
||||
if (plugin.isCallerMinimap() && ArrayUtils.contains(callers, actor.getName()) && minimapLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color);
|
||||
}
|
||||
|
||||
if (plugin.isSnipeMinimap() && ArrayUtils.contains(targets, actor.getName()))
|
||||
{
|
||||
if (minimapLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* 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.warindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@Singleton
|
||||
public class WarIndicatorOverlay extends Overlay
|
||||
{
|
||||
private final WarIndicatorService warIndicatorService;
|
||||
private final WarIndicatorPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorOverlay(final WarIndicatorPlugin plugin, final WarIndicatorService warIndicatorService)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.warIndicatorService = warIndicatorService;
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
warIndicatorService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color));
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
||||
{
|
||||
if (!plugin.isHighlightSnipes() && !plugin.isHighLightCallers())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Polygon poly = actor.getCanvasTilePoly();
|
||||
String[] callers = plugin.getGetActiveCallers().split(", ");
|
||||
String[] targets = plugin.getGetTargetedSnipes().split(", ");
|
||||
|
||||
if (plugin.isCallerTile() && ArrayUtils.contains(callers, actor.getName()) && poly != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
if (plugin.isSnipeTile() && ArrayUtils.contains(targets, actor.getName()) && poly != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
|
||||
String name = actor.getName().replace('\u00A0', ' ');
|
||||
int offset = actor.getLogicalHeight() + 40;
|
||||
Point textLocation = actor.getCanvasTextLocation(graphics, name, offset);
|
||||
|
||||
if (textLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* 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.warindicators;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import static net.runelite.api.MenuOpcode.*;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "War calling indicators",
|
||||
description = "War War War.",
|
||||
tags = {"skill", "total", "max", "PVP"},
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Singleton
|
||||
public class WarIndicatorPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorConfig config;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorOverlay warIndicatorOverlay;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorMiniMapOverlay warIndicatorMiniMapOverlay;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highLightCallers;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color getCallerColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean callerMinimap;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean callerTile;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private String getActiveCallers;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightSnipes;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color getSnipeColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean snipeMinimap;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean snipeTile;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private String getTargetedSnipes;
|
||||
|
||||
@Provides
|
||||
WarIndicatorConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(WarIndicatorConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(warIndicatorOverlay);
|
||||
overlayManager.add(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.remove(warIndicatorOverlay);
|
||||
overlayManager.remove(warIndicatorMiniMapOverlay);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded onMenuEntryAdded)
|
||||
{
|
||||
int type = onMenuEntryAdded.getOpcode();
|
||||
|
||||
if (type >= 2000)
|
||||
{
|
||||
type -= 2000;
|
||||
}
|
||||
|
||||
int identifier = onMenuEntryAdded.getIdentifier();
|
||||
if (type == FOLLOW.getId() || type == TRADE.getId()
|
||||
|| type == SPELL_CAST_ON_PLAYER.getId()
|
||||
|| type == ITEM_USE_ON_PLAYER.getId()
|
||||
|| type == PLAYER_FIRST_OPTION.getId()
|
||||
|| type == PLAYER_SECOND_OPTION.getId()
|
||||
|| type == PLAYER_THIRD_OPTION.getId()
|
||||
|| type == PLAYER_FOURTH_OPTION.getId()
|
||||
|| type == PLAYER_FIFTH_OPTION.getId()
|
||||
|| type == PLAYER_SIXTH_OPTION.getId()
|
||||
|| type == PLAYER_SEVENTH_OPTION.getId()
|
||||
|| type == PLAYER_EIGTH_OPTION.getId())
|
||||
{
|
||||
Player[] players = client.getCachedPlayers();
|
||||
Player player = null;
|
||||
String player2 = null;
|
||||
|
||||
String[] callers = this.getActiveCallers.split(", ");
|
||||
String[] targets = this.getTargetedSnipes.split(", ");
|
||||
|
||||
if (identifier >= 0 && identifier < players.length)
|
||||
{
|
||||
player = players[identifier];
|
||||
player2 = players[identifier].getName();
|
||||
}
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = null;
|
||||
|
||||
if (this.highLightCallers && ArrayUtils.contains(callers, player2))
|
||||
{
|
||||
color = this.getCallerColor;
|
||||
}
|
||||
|
||||
if (this.highlightSnipes && ArrayUtils.contains(targets, player2))
|
||||
{
|
||||
color = this.getSnipeColor;
|
||||
}
|
||||
|
||||
if (color != null)
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
||||
String target = lastEntry.getTarget();
|
||||
|
||||
int idx = target.indexOf('>');
|
||||
if (idx != -1)
|
||||
{
|
||||
target = target.substring(idx + 1);
|
||||
}
|
||||
|
||||
lastEntry.setTarget("<col=" + Integer.toHexString(color.getRGB() & 0xFFFFFF) + ">" + target);
|
||||
client.setMenuEntries(menuEntries);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("warIndicators"))
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.highLightCallers = config.highLightCallers();
|
||||
this.getCallerColor = config.getCallerColor();
|
||||
this.callerMinimap = config.callerMinimap();
|
||||
this.callerTile = config.callerTile();
|
||||
this.getActiveCallers = config.getActiveCallers();
|
||||
this.highlightSnipes = config.highlightSnipes();
|
||||
this.getSnipeColor = config.getSnipeColor();
|
||||
this.snipeMinimap = config.snipeMinimap();
|
||||
this.snipeTile = config.snipeTile();
|
||||
this.getTargetedSnipes = config.getTargetedSnipes();
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* 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.warindicators;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
|
||||
@Singleton
|
||||
public class WarIndicatorService
|
||||
{
|
||||
private final Client client;
|
||||
private final WarIndicatorPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private WarIndicatorService(final Client client, final WarIndicatorPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||
{
|
||||
if (!plugin.isHighlightSnipes() && !plugin.isHighLightCallers())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.isHighlightSnipes())
|
||||
{
|
||||
for (Player player : client.getPlayers())
|
||||
{
|
||||
if (player == null || player.getName() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] targets = plugin.getGetTargetedSnipes().split(", ");
|
||||
|
||||
for (String target : targets)
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(target))
|
||||
{
|
||||
consumer.accept(player, plugin.getGetSnipeColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isHighLightCallers())
|
||||
{
|
||||
for (Player player : client.getPlayers())
|
||||
{
|
||||
if (player == null || player.getName() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] callers = plugin.getGetActiveCallers().split(", ");
|
||||
|
||||
for (String caller : callers)
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(caller))
|
||||
{
|
||||
consumer.accept(player, plugin.getGetCallerColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user