Merge pull request #517 from SomeoneWithAnInternetConnection/boosts-fixes

Fix NullPointerExceptions from Boosts Plugin
This commit is contained in:
Tomas Slusny
2018-02-02 11:49:51 +01:00
committed by GitHub
2 changed files with 24 additions and 8 deletions

View File

@@ -47,6 +47,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
class BoostsOverlay extends Overlay class BoostsOverlay extends Overlay
{ {
private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length - 1]; private final BufferedImage[] imgCache = new BufferedImage[Skill.values().length - 1];
@Getter @Getter
private final BoostIndicator[] indicators = new BoostIndicator[Skill.values().length - 1]; private final BoostIndicator[] indicators = new BoostIndicator[Skill.values().length - 1];
@@ -56,6 +57,7 @@ class BoostsOverlay extends Overlay
@Inject @Inject
private BoostsPlugin plugin; private BoostsPlugin plugin;
private PanelComponent panelComponent; private PanelComponent panelComponent;
@Inject @Inject

View File

@@ -84,6 +84,15 @@ public class BoostsPlugin extends Plugin
return boostsOverlay; return boostsOverlay;
} }
@Override
protected void startUp()
{
if (config.enabled())
{
updateShownSkills(config.enableSkill());
}
}
@Subscribe @Subscribe
public void onConfigChanged(ConfigChanged event) public void onConfigChanged(ConfigChanged event)
{ {
@@ -92,14 +101,7 @@ public class BoostsPlugin extends Plugin
return; return;
} }
if (config.enableSkill()) updateShownSkills(config.enableSkill());
{
shownSkills = ObjectArrays.concat(COMBAT, SKILLING, Skill.class);
}
else
{
shownSkills = COMBAT;
}
if (event.getKey().equals("displayIndicators")) if (event.getKey().equals("displayIndicators"))
{ {
@@ -121,4 +123,16 @@ public class BoostsPlugin extends Plugin
} }
} }
} }
private void updateShownSkills(boolean showSkillingSkills)
{
if (showSkillingSkills)
{
shownSkills = ObjectArrays.concat(COMBAT, SKILLING, Skill.class);
}
else
{
shownSkills = COMBAT;
}
}
} }