grotesqueguardians: Merge nested if statements

This commit is contained in:
sdburns1998
2019-07-07 04:19:28 +02:00
parent 9e802c2688
commit 9ea7287713

View File

@@ -99,22 +99,19 @@ class GrotesqueGuardiansOverlay extends Overlay
{ {
OverlayUtil.renderPolygon(graphics, poly, color); OverlayUtil.renderPolygon(graphics, poly, color);
} }
if ((plugin.isInGargs()) && (plugin.isNeedingToRun())) if (plugin.isInGargs() && plugin.isNeedingToRun() && plugin.getDusk() != null && plugin.getDusk().getLocalLocation() != null)
{ {
if ((plugin.getDusk() != null) && (plugin.getDusk().getLocalLocation() != null)) TextComponent textComponent = new TextComponent();
{ LocalPoint duskPoint;
TextComponent textComponent = new TextComponent();
LocalPoint duskPoint;
duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2); duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2);
net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500);
if (duskLoc != null) if (duskLoc != null)
{ {
textComponent.setText("RUN AWAY"); textComponent.setText("RUN AWAY");
textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY()));
textComponent.setColor(Color.red); textComponent.setColor(Color.red);
textComponent.render(graphics); textComponent.render(graphics);
}
} }
} }
} }