runelite-client: standardize plugin names

This commit is contained in:
honeyhoney
2017-11-13 18:40:46 -05:00
committed by Adam
parent 8dbe5777ff
commit e0d9f5641c
38 changed files with 226 additions and 223 deletions

View File

@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Boosts plugin" name = "Boosts plugin"
) )
public class Boosts extends Plugin public class BoostsPlugin extends Plugin
{ {
@Inject @Inject
BoostsOverlay boostsOverlay; BoostsOverlay boostsOverlay;

View File

@@ -36,11 +36,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Boss timers" name = "Boss timers plugin"
) )
public class BossTimers extends Plugin public class BossTimersPlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(BossTimers.class); private static final Logger logger = LoggerFactory.getLogger(BossTimersPlugin.class);
@Inject @Inject
InfoBoxManager infoBoxManager; InfoBoxManager infoBoxManager;

View File

@@ -31,7 +31,7 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup( @ConfigGroup(
keyName = "chatcommands", keyName = "chatcommands",
name = "Chat commands", name = "Chat Commands",
description = "Configuration for chat commands" description = "Configuration for chat commands"
) )
public interface ChatCommandsConfig extends Config public interface ChatCommandsConfig extends Config

View File

@@ -63,11 +63,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Chat commands" name = "Chat commands plugin"
) )
public class ChatCommands extends Plugin public class ChatCommandsPlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(ChatCommands.class); private static final Logger logger = LoggerFactory.getLogger(ChatCommandsPlugin.class);
private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; private static final float HIGH_ALCHEMY_CONSTANT = 0.6f;

View File

@@ -38,7 +38,7 @@ import net.runelite.client.task.Schedule;
@PluginDescriptor( @PluginDescriptor(
name = "Clan chat plugin" name = "Clan chat plugin"
) )
public class ClanChat extends Plugin public class ClanChatPlugin extends Plugin
{ {
@Inject @Inject
@Nullable @Nullable

View File

@@ -43,7 +43,7 @@ import net.runelite.client.task.Schedule;
@PluginDescriptor( @PluginDescriptor(
name = "Combat level plugin" name = "Combat level plugin"
) )
public class CombatLevel extends Plugin public class CombatLevelPlugin extends Plugin
{ {
private final DecimalFormat decimalFormat = new DecimalFormat("#.###"); private final DecimalFormat decimalFormat = new DecimalFormat("#.###");

View File

@@ -36,7 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Config plugin" name = "Configuration plugin"
) )
public class ConfigPlugin extends Plugin public class ConfigPlugin extends Plugin
{ {

View File

@@ -32,7 +32,6 @@ import java.awt.FontMetrics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.List; import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -76,10 +75,10 @@ public class DevToolsOverlay extends Overlay
private static final int MAX_DISTANCE = 2400; private static final int MAX_DISTANCE = 2400;
private final Client client; private final Client client;
private final DevTools plugin; private final DevToolsPlugin plugin;
@Inject @Inject
public DevToolsOverlay(@Nullable Client client, DevTools plugin) public DevToolsOverlay(@Nullable Client client, DevToolsPlugin plugin)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.client = client; this.client = client;

View File

@@ -25,15 +25,21 @@
*/ */
package net.runelite.client.plugins.devtools; package net.runelite.client.plugins.devtools;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.Collection; import java.util.Collection;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.swing.*; import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
@@ -69,12 +75,12 @@ public class DevToolsPanel extends PluginPanel
private JLabel contentTypeLbl = new JLabel(); private JLabel contentTypeLbl = new JLabel();
private final Client client; private final Client client;
private final DevTools plugin; private final DevToolsPlugin plugin;
private final SettingsTracker settingsTracker; private final SettingsTracker settingsTracker;
@Inject @Inject
public DevToolsPanel(@Nullable Client client, DevTools plugin) public DevToolsPanel(@Nullable Client client, DevToolsPlugin plugin)
{ {
this.client = client; this.client = client;
this.plugin = plugin; this.plugin = plugin;

View File

@@ -38,10 +38,10 @@ import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Developer tools", name = "Developer tools plugin",
developerPlugin = true developerPlugin = true
) )
public class DevTools extends Plugin public class DevToolsPlugin extends Plugin
{ {
@Inject @Inject
ClientUI ui; ClientUI ui;
@@ -77,7 +77,7 @@ public class DevTools extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
panel = injector.getInstance(DevToolsPanel.class); panel = injector.getInstance(DevToolsPanel.class);
navButton = new NavigationButton("DevTools", () -> panel); navButton = new NavigationButton("Developer Tools", () -> panel);
ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("devtools_icon.png"))); ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getResourceAsStream("devtools_icon.png")));
navButton.getButton().setIcon(icon); navButton.getButton().setIcon(icon);

View File

@@ -24,14 +24,6 @@
*/ */
package net.runelite.client.plugins.fightcave; package net.runelite.client.plugins.fightcave;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
@@ -41,7 +33,14 @@ import java.awt.Rectangle;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.imageio.ImageIO;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FightCaveOverlay extends Overlay public class FightCaveOverlay extends Overlay
{ {
@@ -54,13 +53,13 @@ public class FightCaveOverlay extends Overlay
private static final Color RED_BACKGROUND = new Color(255, 0, 0, 100); private static final Color RED_BACKGROUND = new Color(255, 0, 0, 100);
private final Client client; private final Client client;
private final FightCave plugin; private final FightCavePlugin plugin;
private Image protectFromMagicImg; private Image protectFromMagicImg;
private Image protectFromMissilesImg; private Image protectFromMissilesImg;
@Inject @Inject
FightCaveOverlay(@Nullable Client client, FightCave plugin) FightCaveOverlay(@Nullable Client client, FightCavePlugin plugin)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.client = client; this.client = client;

View File

@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Fight cave plugin" name = "Fight cave plugin"
) )
public class FightCave extends Plugin public class FightCavePlugin extends Plugin
{ {
@Inject @Inject
@Nullable @Nullable

View File

@@ -43,10 +43,10 @@ import net.runelite.client.ui.overlay.OverlayPriority;
public class FPSOverlay extends Overlay public class FPSOverlay extends Overlay
{ {
private final Client client; private final Client client;
private final FPS plugin; private final FPSPlugin plugin;
@Inject @Inject
public FPSOverlay(@Nullable Client client, FPS plugin) public FPSOverlay(@Nullable Client client, FPSPlugin plugin)
{ {
super(OverlayPosition.DYNAMIC, OverlayPriority.HIGH); super(OverlayPosition.DYNAMIC, OverlayPriority.HIGH);
this.client = client; this.client = client;

View File

@@ -33,9 +33,9 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Frames per second" name = "Frames per second plugin"
) )
public class FPS extends Plugin public class FPSPlugin extends Plugin
{ {
@Inject @Inject
FPSOverlay overlay; FPSOverlay overlay;

View File

@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Ground items plugin" name = "Ground items plugin"
) )
public class GroundItems extends Plugin public class GroundItemsPlugin extends Plugin
{ {
@Inject @Inject
ConfigManager configManager; ConfigManager configManager;

View File

@@ -41,9 +41,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Hiscore plugin" name = "Hiscore plugin"
) )
public class Hiscore extends Plugin public class HiscorePlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(Hiscore.class); private static final Logger logger = LoggerFactory.getLogger(HiscorePlugin.class);
private static final String LOOKUP = "Lookup"; private static final String LOOKUP = "Lookup";

View File

@@ -48,9 +48,9 @@ import net.runelite.client.task.Schedule;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
@PluginDescriptor( @PluginDescriptor(
name = "Idle notifier" name = "Idle notifier plugin"
) )
public class IdleNotifier extends Plugin public class IdleNotifierPlugin extends Plugin
{ {
@Inject @Inject
RuneLite runelite; RuneLite runelite;

View File

@@ -41,7 +41,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Implings plugin" name = "Implings plugin"
) )
public class Implings extends Plugin public class ImplingsPlugin extends Plugin
{ {
@Inject @Inject
ImplingsOverlay overlay; ImplingsOverlay overlay;

View File

@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Mouse highlight plugin" name = "Mouse highlight plugin"
) )
public class MouseHighlight extends Plugin public class MouseHighlightPlugin extends Plugin
{ {
@Inject @Inject
MouseHighlightConfig config; MouseHighlightConfig config;

View File

@@ -65,7 +65,7 @@ class OpponentInfoOverlay extends Overlay
private float lastRatio = 0; private float lastRatio = 0;
private Instant lastTime = Instant.now(); private Instant lastTime = Instant.now();
private String opponentName; private String opponentName;
private Map<String, Integer> oppInfoHealth = OpponentInfo.loadNpcHealth(); private Map<String, Integer> oppInfoHealth = OpponentInfoPlugin.loadNpcHealth();
@Inject @Inject
OpponentInfoOverlay(@Nullable Client client, OpponentConfig config) OpponentInfoOverlay(@Nullable Client client, OpponentConfig config)

View File

@@ -41,7 +41,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Opponent information plugin" name = "Opponent information plugin"
) )
public class OpponentInfo extends Plugin public class OpponentInfoPlugin extends Plugin
{ {
@Inject @Inject
OpponentInfoOverlay overlay; OpponentInfoOverlay overlay;
@@ -71,7 +71,7 @@ public class OpponentInfo extends Plugin
{ {
}.getType(); }.getType();
InputStream healthFile = OpponentInfo.class.getResourceAsStream("/npc_health.json"); InputStream healthFile = OpponentInfoPlugin.class.getResourceAsStream("/npc_health.json");
return gson.fromJson(new InputStreamReader(healthFile), type); return gson.fromJson(new InputStreamReader(healthFile), type);
} }
} }

View File

@@ -58,13 +58,13 @@ public class PestControlOverlay extends Overlay
private final RuneLite runelite; private final RuneLite runelite;
private final Client client; private final Client client;
private final PestControl plugin; private final PestControlPlugin plugin;
// Pest control game // Pest control game
private Game game; private Game game;
@Inject @Inject
public PestControlOverlay(RuneLite runelite, PestControl plugin) public PestControlOverlay(RuneLite runelite, PestControlPlugin plugin)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.runelite = runelite; this.runelite = runelite;

View File

@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Pest control plugin" name = "Pest control plugin"
) )
public class PestControl extends Plugin public class PestControlPlugin extends Plugin
{ {
private Font font; private Font font;

View File

@@ -38,7 +38,7 @@ import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor( @PluginDescriptor(
name = "Remember username plugin" name = "Remember username plugin"
) )
public class RememberUsername extends Plugin public class RememberUsernamePlugin extends Plugin
{ {
@Inject @Inject
@Nullable @Nullable

View File

@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Runecraft plugin" name = "Runecraft plugin"
) )
public class Runecraft extends Plugin public class RunecraftPlugin extends Plugin
{ {
private static Pattern bindNeckString = Pattern.compile("You have ([0-9]+) charges left before your Binding necklace disintegrates."); private static Pattern bindNeckString = Pattern.compile("You have ([0-9]+) charges left before your Binding necklace disintegrates.");

View File

@@ -35,7 +35,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Runepouch plugin" name = "Runepouch plugin"
) )
public class Runepouch extends Plugin public class RunepouchPlugin extends Plugin
{ {
@Inject @Inject
ConfigManager configManager; ConfigManager configManager;

View File

@@ -54,7 +54,7 @@ class SlayerOverlay extends Overlay
private final RuneLite runelite; private final RuneLite runelite;
private final Client client; private final Client client;
private final SlayerConfig config; private final SlayerConfig config;
private final Slayer plugin; private final SlayerPlugin plugin;
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16); private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
private final Set<Integer> slayerJewelry = Sets.newHashSet( private final Set<Integer> slayerJewelry = Sets.newHashSet(
@@ -85,7 +85,7 @@ class SlayerOverlay extends Overlay
); );
@Inject @Inject
SlayerOverlay(RuneLite runelite, Slayer plugin, SlayerConfig config) SlayerOverlay(RuneLite runelite, SlayerPlugin plugin, SlayerConfig config)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.runelite = runelite; this.runelite = runelite;

View File

@@ -57,9 +57,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Slayer plugin" name = "Slayer plugin"
) )
public class Slayer extends Plugin public class SlayerPlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(Slayer.class); private static final Logger logger = LoggerFactory.getLogger(SlayerPlugin.class);
//Chat messages //Chat messages
private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("You're assigned to kill (.*); only (\\d*) more to go\\."); private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("You're assigned to kill (.*); only (\\d*) more to go\\.");

View File

@@ -39,7 +39,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor( @PluginDescriptor(
name = "Timers plugin" name = "Timers plugin"
) )
public class Timers extends Plugin public class TimersPlugin extends Plugin
{ {
@Inject @Inject
TimersConfig config; TimersConfig config;

View File

@@ -31,14 +31,14 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup( @ConfigGroup(
keyName = "xpglobes", keyName = "xpglobes",
name = "XP Globes", name = "XP Globes",
description = "Configuration for the xp globes plugin" description = "Configuration for the XP globes plugin"
) )
public interface XpGlobesConfig extends Config public interface XpGlobesConfig extends Config
{ {
@ConfigItem( @ConfigItem(
keyName = "enabled", keyName = "enabled",
name = "Enabled", name = "Enabled",
description = "Configures whether or not xp globes are displayed" description = "Configures whether or not XP globes are displayed"
) )
default boolean enabled() default boolean enabled()
{ {

View File

@@ -53,7 +53,7 @@ public class XpGlobesOverlay extends Overlay
private static final Logger logger = LoggerFactory.getLogger(XpGlobesOverlay.class); private static final Logger logger = LoggerFactory.getLogger(XpGlobesOverlay.class);
private final Client client; private final Client client;
private final XpGlobes plugin; private final XpGlobesPlugin plugin;
private final XpGlobesConfig config; private final XpGlobesConfig config;
private static final int DEFAULT_CIRCLE_WIDTH = 40; private static final int DEFAULT_CIRCLE_WIDTH = 40;
@@ -76,7 +76,7 @@ public class XpGlobesOverlay extends Overlay
private static final int TOOLTIP_RECT_SIZE_Y = 80; private static final int TOOLTIP_RECT_SIZE_Y = 80;
@Inject @Inject
public XpGlobesOverlay(@Nullable Client client, XpGlobes plugin, XpGlobesConfig config) public XpGlobesOverlay(@Nullable Client client, XpGlobesPlugin plugin, XpGlobesConfig config)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.client = client; this.client = client;

View File

@@ -44,9 +44,9 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor( @PluginDescriptor(
name = "Xp Globes plugin" name = "XP globes plugin"
) )
public class XpGlobes extends Plugin public class XpGlobesPlugin extends Plugin
{ {
private static final int SECONDS_TO_SHOW_GLOBE = 10; private static final int SECONDS_TO_SHOW_GLOBE = 10;
private static final int MAXIMUM_SHOWN_GLOBES = 5; private static final int MAXIMUM_SHOWN_GLOBES = 5;

View File

@@ -46,11 +46,11 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
public class XPPanel extends PluginPanel public class XpPanel extends PluginPanel
{ {
private static final Logger logger = LoggerFactory.getLogger(XPPanel.class); private static final Logger logger = LoggerFactory.getLogger(XpPanel.class);
private Map<Skill, JPanel> labelMap = new HashMap<>(); private Map<Skill, JPanel> labelMap = new HashMap<>();
private final XPTracker xpTracker; private final XpTrackerPlugin xpTracker;
private JPanel statsPanel; private JPanel statsPanel;
@Inject @Inject
@@ -61,7 +61,7 @@ public class XPPanel extends PluginPanel
ScheduledExecutorService executor; ScheduledExecutorService executor;
@Inject @Inject
public XPPanel(XPTracker xpTracker) public XpPanel(XpTrackerPlugin xpTracker)
{ {
this.xpTracker = xpTracker; this.xpTracker = xpTracker;
@@ -119,7 +119,7 @@ public class XPPanel extends PluginPanel
String skillIcon = "/skill_icons/" + skill.getName().toLowerCase() + ".png"; String skillIcon = "/skill_icons/" + skill.getName().toLowerCase() + ".png";
logger.debug("Loading skill icon from {}", skillIcon); logger.debug("Loading skill icon from {}", skillIcon);
JLabel icon = new JLabel(new ImageIcon(ImageIO.read(XPPanel.class.getResourceAsStream(skillIcon)))); JLabel icon = new JLabel(new ImageIcon(ImageIO.read(XpPanel.class.getResourceAsStream(skillIcon))));
iconLevel.add(icon, BorderLayout.LINE_START); iconLevel.add(icon, BorderLayout.LINE_START);
iconLevel.add(levelLabel, BorderLayout.CENTER); iconLevel.add(levelLabel, BorderLayout.CENTER);

View File

@@ -40,9 +40,9 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule; import net.runelite.client.task.Schedule;
@PluginDescriptor( @PluginDescriptor(
name = "XP Tracker plugin" name = "XP tracker plugin"
) )
public class XPTracker extends Plugin public class XpTrackerPlugin extends Plugin
{ {
private static final int NUMBER_OF_SKILLS = Skill.values().length - 1; //ignore overall private static final int NUMBER_OF_SKILLS = Skill.values().length - 1; //ignore overall
@@ -54,15 +54,14 @@ public class XPTracker extends Plugin
Client client; Client client;
private NavigationButton navButton; private NavigationButton navButton;
private XPPanel xpPanel; private XpPanel xpPanel;
private final SkillXPInfo[] xpInfos = new SkillXPInfo[NUMBER_OF_SKILLS]; private final SkillXPInfo[] xpInfos = new SkillXPInfo[NUMBER_OF_SKILLS];
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
navButton = new NavigationButton("XP Tracker", () -> xpPanel); navButton = new NavigationButton("XP Tracker", () -> xpPanel);
xpPanel = injector.getInstance(XPPanel.class); xpPanel = injector.getInstance(XpPanel.class);
navButton.getButton().setText("XP"); navButton.getButton().setText("XP");
ui.getPluginToolbar().addNavigation(navButton); ui.getPluginToolbar().addNavigation(navButton);
} }

View File

@@ -43,9 +43,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Xtea plugin" name = "Xtea plugin"
) )
public class Xtea extends Plugin public class XteaPlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(Xtea.class); private static final Logger logger = LoggerFactory.getLogger(XteaPlugin.class);
private final XteaClient xteaClient = new XteaClient(); private final XteaClient xteaClient = new XteaClient();

View File

@@ -69,13 +69,13 @@ public class ZulrahOverlay extends Overlay
private static final Color JAD_BACKGROUND_COLOR = new Color(255, 115, 0, 100); private static final Color JAD_BACKGROUND_COLOR = new Color(255, 115, 0, 100);
private final Client client; private final Client client;
private final Zulrah plugin; private final ZulrahPlugin plugin;
private final Image[] zulrahImages = new Image[3]; private final Image[] zulrahImages = new Image[3];
private final Image[] smallZulrahImages = new Image[3]; private final Image[] smallZulrahImages = new Image[3];
private final Image[] prayerImages = new Image[2]; private final Image[] prayerImages = new Image[2];
@Inject @Inject
ZulrahOverlay(@Nullable Client client, Zulrah plugin) ZulrahOverlay(@Nullable Client client, ZulrahPlugin plugin)
{ {
super(OverlayPosition.DYNAMIC); super(OverlayPosition.DYNAMIC);
this.client = client; this.client = client;

View File

@@ -54,9 +54,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor( @PluginDescriptor(
name = "Zulrah plugin" name = "Zulrah plugin"
) )
public class Zulrah extends Plugin public class ZulrahPlugin extends Plugin
{ {
private static final Logger logger = LoggerFactory.getLogger(Zulrah.class); private static final Logger logger = LoggerFactory.getLogger(ZulrahPlugin.class);
@Inject @Inject
RuneLite runelite; RuneLite runelite;

View File

@@ -1,143 +1,143 @@
/* /*
* Copyright (c) 2017, Adam <Adam@sigterm.info> * Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this * 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, * 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * 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 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.plugins.slayer; package net.runelite.client.plugins.slayer;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind; import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule; import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject; import javax.inject.Inject;
import static net.runelite.api.ChatMessageType.SERVER; import static net.runelite.api.ChatMessageType.SERVER;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.client.events.ChatMessage; import net.runelite.client.events.ChatMessage;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class SlayerTest public class SlayerPluginTest
{ {
private static final String TASK_ONE = "You've completed one task; return to a Slayer master."; private static final String TASK_ONE = "You've completed one task; return to a Slayer master.";
private static final String TASK_COMPLETE_NO_POINTS = "<col=ef1020>You've completed 3 tasks; return to a Slayer master.</col>"; private static final String TASK_COMPLETE_NO_POINTS = "<col=ef1020>You've completed 3 tasks; return to a Slayer master.</col>";
private static final String TASK_POINTS = "You've completed 9 tasks and received 0 points, giving you a total of 18,000; return to a Slayer master."; private static final String TASK_POINTS = "You've completed 9 tasks and received 0 points, giving you a total of 18,000; return to a Slayer master.";
private static final String TASK_COMPLETE = "You need something new to hunt."; private static final String TASK_COMPLETE = "You need something new to hunt.";
private static final String TASK_CANCELED = "Your task has been cancelled."; private static final String TASK_CANCELED = "Your task has been cancelled.";
@Mock @Mock
@Bind @Bind
Client client; Client client;
@Mock @Mock
@Bind @Bind
SlayerConfig slayerConfig; SlayerConfig slayerConfig;
@Mock @Mock
@Bind @Bind
SlayerOverlay overlay; SlayerOverlay overlay;
@Mock @Mock
@Bind @Bind
InfoBoxManager infoBoxManager; InfoBoxManager infoBoxManager;
@Mock @Mock
@Bind @Bind
ItemManager itemManager; ItemManager itemManager;
@Inject @Inject
Slayer slayerPlugin; SlayerPlugin slayerPlugin;
@Before @Before
public void before() public void before()
{ {
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(slayerConfig.enabled()).thenReturn(true); when(slayerConfig.enabled()).thenReturn(true);
} }
@Test @Test
public void testOneTask() public void testOneTask()
{ {
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_ONE, null); ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_ONE, null);
slayerPlugin.onChatMessage(chatMessageEvent); slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getStreak()); assertEquals(1, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName()); assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount()); assertEquals(0, slayerPlugin.getAmount());
} }
@Test @Test
public void testNoPoints() public void testNoPoints()
{ {
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null); ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent); slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(3, slayerPlugin.getStreak()); assertEquals(3, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName()); assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount()); assertEquals(0, slayerPlugin.getAmount());
} }
@Test @Test
public void testPoints() public void testPoints()
{ {
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_POINTS, null); ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent); slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(9, slayerPlugin.getStreak()); assertEquals(9, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName()); assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount()); assertEquals(0, slayerPlugin.getAmount());
assertEquals(18_000, slayerPlugin.getPoints()); assertEquals(18_000, slayerPlugin.getPoints());
} }
@Test @Test
public void testComplete() public void testComplete()
{ {
slayerPlugin.setTaskName("cows"); slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42); slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE, null); ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE, null);
slayerPlugin.onChatMessage(chatMessageEvent); slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName()); assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount()); assertEquals(0, slayerPlugin.getAmount());
} }
@Test @Test
public void testCancelled() public void testCancelled()
{ {
slayerPlugin.setTaskName("cows"); slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42); slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_CANCELED, null); ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_CANCELED, null);
slayerPlugin.onChatMessage(chatMessageEvent); slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName()); assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount()); assertEquals(0, slayerPlugin.getAmount());
} }
} }