npchighlight: Merge nested if statements

This commit is contained in:
sdburns1998
2019-07-07 15:56:05 +02:00
parent 8c8a716663
commit 8cd89cbbb2

View File

@@ -562,14 +562,11 @@ public class NpcIndicatorsPlugin extends Plugin
{ {
for (NPC npc : despawnedNpcsThisTick) 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 // NPC teleported away, so we don't want to add the respawn timer
continue; continue;
} }
}
if (isInViewRange(client.getLocalPlayer().getWorldLocation(), npc.getWorldLocation())) if (isInViewRange(client.getLocalPlayer().getWorldLocation(), npc.getWorldLocation()))
{ {
@@ -590,15 +587,13 @@ public class NpcIndicatorsPlugin extends Plugin
for (NPC npc : spawnedNpcsThisTick) for (NPC npc : spawnedNpcsThisTick)
{ {
if (!teleportGraphicsObjectSpawnedThisTick.isEmpty()) if (!teleportGraphicsObjectSpawnedThisTick.isEmpty() &&
{ (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation()) ||
if (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation()) || teleportGraphicsObjectSpawnedThisTick.contains(getWorldLocationBehind(npc))))
teleportGraphicsObjectSpawnedThisTick.contains(getWorldLocationBehind(npc)))
{ {
// NPC teleported here, so we don't want to update the respawn timer // NPC teleported here, so we don't want to update the respawn timer
continue; continue;
} }
}
if (lastPlayerLocation != null && isInViewRange(lastPlayerLocation, npc.getWorldLocation())) if (lastPlayerLocation != null && isInViewRange(lastPlayerLocation, npc.getWorldLocation()))
{ {