From d7efba6295a52310c1d8ab7217f238ec39999e5e Mon Sep 17 00:00:00 2001 From: Lotto Date: Mon, 16 Apr 2018 23:03:49 +0200 Subject: [PATCH] hiscore panel: fix not displaying total level correctly --- .../client/plugins/hiscore/HiscorePanel.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index 41843e72a7..bde455a2ec 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -38,7 +38,10 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.ScheduledExecutorService; import javax.annotation.Nullable; import javax.imageio.ImageIO; @@ -100,8 +103,10 @@ public class HiscorePanel extends PluginPanel private static final String SKILL_NAME = "SKILL_NAME"; private static final String SKILL = "SKILL"; - private static final HiscoreSkill[] SKILL_PANEL_ORDER = new HiscoreSkill[] - { + /** + * Real skills, ordered in the way they should be displayed in the panel. + */ + private static final Set SKILLS = new LinkedHashSet<>(Arrays.asList( ATTACK, HITPOINTS, MINING, STRENGTH, AGILITY, SMITHING, DEFENCE, HERBLORE, FISHING, @@ -110,7 +115,7 @@ public class HiscorePanel extends PluginPanel MAGIC, FLETCHING, WOODCUTTING, RUNECRAFT, SLAYER, FARMING, CONSTRUCTION, HUNTER - }; + )); @Inject ScheduledExecutorService executor; @@ -214,7 +219,7 @@ public class HiscorePanel extends PluginPanel statsPanel.setBorder(subPanelBorder); // For each skill on the ingame skill panel, create a Label and add it to the UI - for (HiscoreSkill skill : SKILL_PANEL_ORDER) + for (HiscoreSkill skill : SKILLS) { JPanel panel = makeSkillPanel(skill.getName(), skill); statsPanel.add(panel); @@ -550,7 +555,7 @@ public class HiscorePanel extends PluginPanel Skill s = result.getSkill(skill); int level; - if (config.virtualLevels() && s.getExperience() >= 0) + if (config.virtualLevels() && SKILLS.contains(skill)) { level = Experience.getLevelForXp((int) s.getExperience()); }