From 9ea728771362bb378956b068e9318c052e66efeb Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Sun, 7 Jul 2019 04:19:28 +0200 Subject: [PATCH] grotesqueguardians: Merge nested if statements --- .../GrotesqueGuardiansOverlay.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java index ed8602718b..0568e9f16d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java @@ -99,22 +99,19 @@ class GrotesqueGuardiansOverlay extends Overlay { 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); - net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); - if (duskLoc != null) - { - textComponent.setText("RUN AWAY"); - textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); - textComponent.setColor(Color.red); - textComponent.render(graphics); - } + 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); + if (duskLoc != null) + { + textComponent.setText("RUN AWAY"); + textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); + textComponent.setColor(Color.red); + textComponent.render(graphics); } } }