From 8cd89cbbb238c70bd6eabdc02f3be699193226aa Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Sun, 7 Jul 2019 15:56:05 +0200 Subject: [PATCH] npchighlight: Merge nested if statements --- .../npchighlight/NpcIndicatorsPlugin.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java index 122599d15c..a65fbf0b4c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java @@ -562,13 +562,10 @@ public class NpcIndicatorsPlugin extends Plugin { for (NPC npc : despawnedNpcsThisTick) { - if (!teleportGraphicsObjectSpawnedThisTick.isEmpty()) + if (!teleportGraphicsObjectSpawnedThisTick.isEmpty() && teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation())) { - if (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation())) - { - // NPC teleported away, so we don't want to add the respawn timer - continue; - } + // NPC teleported away, so we don't want to add the respawn timer + continue; } if (isInViewRange(client.getLocalPlayer().getWorldLocation(), npc.getWorldLocation())) @@ -590,14 +587,12 @@ public class NpcIndicatorsPlugin extends Plugin for (NPC npc : spawnedNpcsThisTick) { - if (!teleportGraphicsObjectSpawnedThisTick.isEmpty()) + if (!teleportGraphicsObjectSpawnedThisTick.isEmpty() && + (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation()) || + teleportGraphicsObjectSpawnedThisTick.contains(getWorldLocationBehind(npc)))) { - if (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation()) || - teleportGraphicsObjectSpawnedThisTick.contains(getWorldLocationBehind(npc))) - { - // NPC teleported here, so we don't want to update the respawn timer - continue; - } + // NPC teleported here, so we don't want to update the respawn timer + continue; } if (lastPlayerLocation != null && isInViewRange(lastPlayerLocation, npc.getWorldLocation()))