Merge pull request #5083 from raiyni/corp-dmg

corp: hide damage overlay
This commit is contained in:
Adam
2018-08-24 19:55:37 -04:00
committed by GitHub
2 changed files with 26 additions and 10 deletions

View File

@@ -41,4 +41,15 @@ public interface CorpConfig extends Config
{ {
return true; return true;
} }
@ConfigItem(
keyName = "showDamage",
name = "Show damage overlay",
description = "Show total damage overlay",
position = 2
)
default boolean showDamage()
{
return true;
}
} }

View File

@@ -47,17 +47,19 @@ class CorpDamageOverlay extends Overlay
{ {
private final Client client; private final Client client;
private final CorpPlugin corpPlugin; private final CorpPlugin corpPlugin;
private final CorpConfig config;
private final PanelComponent panelComponent = new PanelComponent(); private final PanelComponent panelComponent = new PanelComponent();
@Inject @Inject
private CorpDamageOverlay(Client client, CorpPlugin corpPlugin) private CorpDamageOverlay(Client client, CorpPlugin corpPlugin, CorpConfig config)
{ {
setPosition(OverlayPosition.TOP_LEFT); setPosition(OverlayPosition.TOP_LEFT);
setLayer(OverlayLayer.UNDER_WIDGETS); setLayer(OverlayLayer.UNDER_WIDGETS);
setPriority(OverlayPriority.LOW); setPriority(OverlayPriority.LOW);
this.client = client; this.client = client;
this.corpPlugin = corpPlugin; this.corpPlugin = corpPlugin;
this.config = config;
} }
@Override @Override
@@ -114,16 +116,19 @@ class CorpDamageOverlay extends Overlay
} }
} }
panelComponent.getChildren().add(LineComponent.builder() if (config.showDamage())
.left("Your damage") {
.right(Integer.toString(myDamage)) panelComponent.getChildren().add(LineComponent.builder()
.rightColor(damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED) .left("Your damage")
.build()); .right(Integer.toString(myDamage))
.rightColor(damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED)
.build());
panelComponent.getChildren().add(LineComponent.builder() panelComponent.getChildren().add(LineComponent.builder()
.left("Total damage") .left("Total damage")
.right(Integer.toString(totalDamage)) .right(Integer.toString(totalDamage))
.build()); .build());
}
return panelComponent.render(graphics); return panelComponent.render(graphics);
} }