boosts: cleanup

This commit is contained in:
Adam
2022-06-19 00:10:22 -04:00
parent fcd869fa10
commit 1d616c9050
3 changed files with 6 additions and 15 deletions

View File

@@ -32,7 +32,7 @@ import net.runelite.api.Skill;
import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBox;
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
public class BoostIndicator extends InfoBox class BoostIndicator extends InfoBox
{ {
private final BoostsPlugin plugin; private final BoostsPlugin plugin;
private final BoostsConfig config; private final BoostsConfig config;
@@ -87,7 +87,7 @@ public class BoostIndicator extends InfoBox
@Override @Override
public boolean render() public boolean render()
{ {
return config.displayInfoboxes() && plugin.canShowBoosts() && plugin.getSkillsToDisplay().contains(getSkill()); return plugin.canShowBoosts() && plugin.getSkillsToDisplay().contains(getSkill()) && config.displayInfoboxes();
} }
@Override @Override

View File

@@ -61,13 +61,13 @@ class BoostsOverlay extends OverlayPanel
@Override @Override
public Dimension render(Graphics2D graphics) public Dimension render(Graphics2D graphics)
{ {
if (config.displayInfoboxes()) final Set<Skill> boostedSkills = plugin.getSkillsToDisplay();
if (boostedSkills.isEmpty() || !config.displayPanel())
{ {
return null; return null;
} }
int nextChange = plugin.getChangeDownTicks(); int nextChange = plugin.getChangeDownTicks();
if (nextChange != -1) if (nextChange != -1)
{ {
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
@@ -77,7 +77,6 @@ class BoostsOverlay extends OverlayPanel
} }
nextChange = plugin.getChangeUpTicks(); nextChange = plugin.getChangeUpTicks();
if (nextChange != -1) if (nextChange != -1)
{ {
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
@@ -86,13 +85,6 @@ class BoostsOverlay extends OverlayPanel
.build()); .build());
} }
final Set<Skill> boostedSkills = plugin.getSkillsToDisplay();
if (boostedSkills.isEmpty())
{
return super.render(graphics);
}
if (plugin.canShowBoosts()) if (plugin.canShowBoosts())
{ {
for (Skill skill : boostedSkills) for (Skill skill : boostedSkills)
@@ -136,6 +128,5 @@ class BoostsOverlay extends OverlayPanel
} }
return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN; return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN;
} }
} }

View File

@@ -29,7 +29,7 @@ import java.awt.image.BufferedImage;
import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBox;
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
public class StatChangeIndicator extends InfoBox class StatChangeIndicator extends InfoBox
{ {
private final boolean up; private final boolean up;
private final BoostsPlugin plugin; private final BoostsPlugin plugin;
@@ -61,6 +61,6 @@ public class StatChangeIndicator extends InfoBox
public boolean render() public boolean render()
{ {
final int time = up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks(); final int time = up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks();
return config.displayInfoboxes() && time != -1; return time != -1 && config.displayInfoboxes();
} }
} }