Merge pull request #207 from honeyhoney/standardise_plugin_names

Standardised plugin names and jewellery count plugin refactor
This commit is contained in:
Adam
2017-11-13 18:42:24 -05:00
committed by GitHub
43 changed files with 262 additions and 266 deletions

View File

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

View File

@@ -36,11 +36,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@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
InfoBoxManager infoBoxManager;

View File

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

View File

@@ -63,11 +63,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@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;

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,15 +25,21 @@
*/
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 javax.annotation.Nullable;
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.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
@@ -69,12 +75,12 @@ public class DevToolsPanel extends PluginPanel
private JLabel contentTypeLbl = new JLabel();
private final Client client;
private final DevTools plugin;
private final DevToolsPlugin plugin;
private final SettingsTracker settingsTracker;
@Inject
public DevToolsPanel(@Nullable Client client, DevTools plugin)
public DevToolsPanel(@Nullable Client client, DevToolsPlugin plugin)
{
this.client = client;
this.plugin = plugin;

View File

@@ -38,10 +38,10 @@ import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Developer tools",
name = "Developer tools plugin",
developerPlugin = true
)
public class DevTools extends Plugin
public class DevToolsPlugin extends Plugin
{
@Inject
ClientUI ui;
@@ -77,7 +77,7 @@ public class DevTools extends Plugin
protected void startUp() throws Exception
{
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")));
navButton.getButton().setIcon(icon);

View File

@@ -24,14 +24,6 @@
*/
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.Dimension;
import java.awt.FontMetrics;
@@ -41,7 +33,14 @@ import java.awt.Rectangle;
import java.io.IOException;
import java.io.InputStream;
import javax.annotation.Nullable;
import javax.imageio.ImageIO;
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
{
@@ -54,13 +53,13 @@ public class FightCaveOverlay extends Overlay
private static final Color RED_BACKGROUND = new Color(255, 0, 0, 100);
private final Client client;
private final FightCave plugin;
private final FightCavePlugin plugin;
private Image protectFromMagicImg;
private Image protectFromMissilesImg;
@Inject
FightCaveOverlay(@Nullable Client client, FightCave plugin)
FightCaveOverlay(@Nullable Client client, FightCavePlugin plugin)
{
super(OverlayPosition.DYNAMIC);
this.client = client;

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,9 +41,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor(
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";

View File

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

View File

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

View File

@@ -22,15 +22,15 @@
* (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.jewelrycount;
package net.runelite.client.plugins.jewellerycount;
import java.util.HashMap;
import java.util.Map;
import static net.runelite.api.ItemID.*;
import static net.runelite.client.plugins.jewelrycount.JewelryType.*;
import static net.runelite.client.plugins.jewellerycount.JewelleryType.*;
public enum JewelryCharges
public enum JewelleryCharges
{
GLORY1(GLORY, AMULET_OF_GLORY1, 1),
GLORY2(GLORY, AMULET_OF_GLORY2, 2),
@@ -110,28 +110,28 @@ public enum JewelryCharges
TCRYSTAL2(TCRYSTAL, TELEPORT_CRYSTAL_2, 2),
TCRYSTAL1(TCRYSTAL, TELEPORT_CRYSTAL_1, 1);
private final JewelryType type;
private final JewelleryType type;
private final int id;
private final int charges;
private static final Map<Integer, JewelryCharges> ITEM_ID = new HashMap<>();
private static final Map<Integer, JewelleryCharges> ITEM_ID = new HashMap<>();
static
{
for (JewelryCharges s : values())
for (JewelleryCharges s : values())
{
ITEM_ID.put(s.getId(), s);
}
}
JewelryCharges(JewelryType type, int ID, int charges)
JewelleryCharges(JewelleryType type, int ID, int charges)
{
this.type = type;
this.id = ID;
this.charges = charges;
}
public JewelryType getType()
public JewelleryType getType()
{
return type;
}
@@ -146,7 +146,7 @@ public enum JewelryCharges
return charges;
}
public static JewelryCharges getCharges(int id)
public static JewelleryCharges getCharges(int id)
{
return ITEM_ID.get(id);
}

View File

@@ -22,23 +22,23 @@
* (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.jewelrycount;
package net.runelite.client.plugins.jewellerycount;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "jewelrycount",
name = "Jewelry Count",
description = "Configuration for the jewelry count plugin"
keyName = "jewellerycount",
name = "Jewellery Count",
description = "Configuration for the jewellery count plugin"
)
public interface JewelryCountConfig extends Config
public interface JewelleryCountConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable",
description = "Configures whether or not the jewelry count plugin is displayed"
description = "Configures whether or not the jewellery count plugin is displayed"
)
default boolean enabled()
{

View File

@@ -22,7 +22,7 @@
* (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.jewelrycount;
package net.runelite.client.plugins.jewellerycount;
import java.awt.Color;
import java.awt.Dimension;
@@ -46,14 +46,14 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
class JewelryCountOverlay extends Overlay
class JewelleryCountOverlay extends Overlay
{
private final RuneLite runelite;
private final JewelryCountConfig config;
private final JewelleryCountConfig config;
private final Font font = FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, 16);
@Inject
JewelryCountOverlay(RuneLite runelite, JewelryCountConfig config)
JewelleryCountOverlay(RuneLite runelite, JewelleryCountConfig config)
{
super(OverlayPosition.DYNAMIC);
this.runelite = runelite;
@@ -74,9 +74,9 @@ class JewelryCountOverlay extends Overlay
graphics.setFont(font);
for (WidgetItem item : getJewelryWidgetItems())
for (WidgetItem item : getJewelleryWidgetItems())
{
JewelryCharges charges = JewelryCharges.getCharges(item.getId());
JewelleryCharges charges = JewelleryCharges.getCharges(item.getId());
if (charges == null)
{
@@ -90,7 +90,7 @@ class JewelryCountOverlay extends Overlay
return null;
}
private Collection<WidgetItem> getJewelryWidgetItems()
private Collection<WidgetItem> getJewelleryWidgetItems()
{
Query inventoryQuery = new InventoryItemQuery();
WidgetItem[] inventoryWidgetItems = runelite.runQuery(inventoryQuery);
@@ -102,10 +102,10 @@ class JewelryCountOverlay extends Overlay
);
WidgetItem[] equipmentWidgetItems = runelite.runQuery(equipmentQuery);
Collection<WidgetItem> jewelry = new ArrayList<>();
jewelry.addAll(Arrays.asList(inventoryWidgetItems));
jewelry.addAll(Arrays.asList(equipmentWidgetItems));
return jewelry;
Collection<WidgetItem> jewellery = new ArrayList<>();
jewellery.addAll(Arrays.asList(inventoryWidgetItems));
jewellery.addAll(Arrays.asList(equipmentWidgetItems));
return jewellery;
}
private void renderWidgetText(Graphics2D graphics, Rectangle bounds, int charges, Color color)

View File

@@ -22,7 +22,7 @@
* (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.jewelrycount;
package net.runelite.client.plugins.jewellerycount;
import com.google.inject.Binder;
import com.google.inject.Provides;
@@ -30,34 +30,27 @@ import javax.inject.Inject;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Jewelry plugin"
name = "Jewellery count plugin"
)
public class JewelryCount extends Plugin
public class JewelleryCountPlugin extends Plugin
{
@Inject
JewelryCountConfig config;
JewelleryCountConfig config;
@Inject
JewelryCountOverlay overlay;
JewelleryCountOverlay overlay;
@Override
public void configure(Binder binder)
{
binder.bind(JewelryCountOverlay.class);
binder.bind(JewelleryCountOverlay.class);
}
@Provides
JewelryCountConfig getConfig(ConfigManager configManager)
JewelleryCountConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(JewelryCountConfig.class);
}
@Override
public Overlay getOverlay()
{
return overlay;
return configManager.getConfig(JewelleryCountConfig.class);
}
}

View File

@@ -22,9 +22,9 @@
* (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.jewelrycount;
package net.runelite.client.plugins.jewellerycount;
public enum JewelryType
public enum JewelleryType
{
GLORY,
ROD,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,7 @@ import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
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.");

View File

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

View File

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

View File

@@ -57,9 +57,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor(
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
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(
name = "Timers plugin"
)
public class Timers extends Plugin
public class TimersPlugin extends Plugin
{
@Inject
TimersConfig config;

View File

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

View File

@@ -53,7 +53,7 @@ public class XpGlobesOverlay extends Overlay
private static final Logger logger = LoggerFactory.getLogger(XpGlobesOverlay.class);
private final Client client;
private final XpGlobes plugin;
private final XpGlobesPlugin plugin;
private final XpGlobesConfig config;
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;
@Inject
public XpGlobesOverlay(@Nullable Client client, XpGlobes plugin, XpGlobesConfig config)
public XpGlobesOverlay(@Nullable Client client, XpGlobesPlugin plugin, XpGlobesConfig config)
{
super(OverlayPosition.DYNAMIC);
this.client = client;

View File

@@ -44,9 +44,9 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.Overlay;
@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 MAXIMUM_SHOWN_GLOBES = 5;

View File

@@ -46,11 +46,11 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
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 final XPTracker xpTracker;
private final XpTrackerPlugin xpTracker;
private JPanel statsPanel;
@Inject
@@ -61,7 +61,7 @@ public class XPPanel extends PluginPanel
ScheduledExecutorService executor;
@Inject
public XPPanel(XPTracker xpTracker)
public XpPanel(XpTrackerPlugin xpTracker)
{
this.xpTracker = xpTracker;
@@ -119,7 +119,7 @@ public class XPPanel extends PluginPanel
String skillIcon = "/skill_icons/" + skill.getName().toLowerCase() + ".png";
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(levelLabel, BorderLayout.CENTER);

View File

@@ -40,9 +40,9 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
@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
@@ -54,15 +54,14 @@ public class XPTracker extends Plugin
Client client;
private NavigationButton navButton;
private XPPanel xpPanel;
private XpPanel xpPanel;
private final SkillXPInfo[] xpInfos = new SkillXPInfo[NUMBER_OF_SKILLS];
@Override
protected void startUp() throws Exception
{
navButton = new NavigationButton("XP Tracker", () -> xpPanel);
xpPanel = injector.getInstance(XPPanel.class);
xpPanel = injector.getInstance(XpPanel.class);
navButton.getButton().setText("XP");
ui.getPluginToolbar().addNavigation(navButton);
}

View File

@@ -43,9 +43,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor(
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();

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 final Client client;
private final Zulrah plugin;
private final ZulrahPlugin plugin;
private final Image[] zulrahImages = new Image[3];
private final Image[] smallZulrahImages = new Image[3];
private final Image[] prayerImages = new Image[2];
@Inject
ZulrahOverlay(@Nullable Client client, Zulrah plugin)
ZulrahOverlay(@Nullable Client client, ZulrahPlugin plugin)
{
super(OverlayPosition.DYNAMIC);
this.client = client;

View File

@@ -54,9 +54,9 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor(
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
RuneLite runelite;

View File

@@ -1,143 +1,143 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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.slayer;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject;
import static net.runelite.api.ChatMessageType.SERVER;
import net.runelite.api.Client;
import net.runelite.client.events.ChatMessage;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import static org.mockito.Mockito.when;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class SlayerTest
{
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_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_CANCELED = "Your task has been cancelled.";
@Mock
@Bind
Client client;
@Mock
@Bind
SlayerConfig slayerConfig;
@Mock
@Bind
SlayerOverlay overlay;
@Mock
@Bind
InfoBoxManager infoBoxManager;
@Mock
@Bind
ItemManager itemManager;
@Inject
Slayer slayerPlugin;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(slayerConfig.enabled()).thenReturn(true);
}
@Test
public void testOneTask()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_ONE, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testNoPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(3, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(9, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
assertEquals(18_000, slayerPlugin.getPoints());
}
@Test
public void testComplete()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testCancelled()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_CANCELED, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
}
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* 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.slayer;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject;
import static net.runelite.api.ChatMessageType.SERVER;
import net.runelite.api.Client;
import net.runelite.client.events.ChatMessage;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import static org.mockito.Mockito.when;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class SlayerPluginTest
{
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_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_CANCELED = "Your task has been cancelled.";
@Mock
@Bind
Client client;
@Mock
@Bind
SlayerConfig slayerConfig;
@Mock
@Bind
SlayerOverlay overlay;
@Mock
@Bind
InfoBoxManager infoBoxManager;
@Mock
@Bind
ItemManager itemManager;
@Inject
SlayerPlugin slayerPlugin;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(slayerConfig.enabled()).thenReturn(true);
}
@Test
public void testOneTask()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_ONE, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testNoPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE_NO_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(3, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_POINTS, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(9, slayerPlugin.getStreak());
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
assertEquals(18_000, slayerPlugin.getPoints());
}
@Test
public void testComplete()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_COMPLETE, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testCancelled()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(SERVER, "Perterter", TASK_CANCELED, null);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
}