theatre: MErge nested if statements

This commit is contained in:
sdburns1998
2019-07-07 21:40:59 +02:00
parent 5a32de3039
commit 9259430894
5 changed files with 75 additions and 109 deletions

View File

@@ -134,15 +134,12 @@ public class BloatHandler extends RoomHandler
@Subscribe
public void onVarbitChanged(VarbitChanged event)
{
if (client.getVar(Varbits.BLOAT_DOOR) == 1)
{
if (!bloatFlag)
if (client.getVar(Varbits.BLOAT_DOOR) == 1 && !bloatFlag)
{
bloatTimer = 0;
bloatFlag = true;
}
}
}
public void onNpcSpawned(NpcSpawned event)
{

View File

@@ -240,14 +240,11 @@ public class MaidenHandler extends RoomHandler
{
NPC npc = event.getNpc();
if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos"))
{
if (npc.getId() == -1)
if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos") && npc.getId() == -1)
{
nylos.removeIf(c -> c.getNpc() == npc);
}
}
}
public void onChatMessage(ChatMessage event)
{

View File

@@ -105,9 +105,7 @@ public class VerzikHandler extends RoomHandler
if (id == TheatreConstant.VERZIK_ID_P1)
{
if (plugin.isP1attacks())
{
if (this.versikCounter >= 0)
if (plugin.isP1attacks() && this.versikCounter >= 0)
{
String str = Integer.toString(versikCounter);
@@ -117,12 +115,9 @@ public class VerzikHandler extends RoomHandler
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
}
}
}
else if (id == TheatreConstant.VERZIK_ID_P2)
{
if (plugin.isP2attacks())
{
if (this.versikCounter >= 0)
if (plugin.isP2attacks() && this.versikCounter >= 0)
{
String str = Integer.toString(versikCounter);
@@ -132,13 +127,8 @@ public class VerzikHandler extends RoomHandler
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
}
}
}
else if (id == TheatreConstant.VERZIK_ID_P3)
{
if (plugin.isP3attacks())
{
if (versikCounter > 0 && versikCounter < 8)
else if (id == TheatreConstant.VERZIK_ID_P3 && plugin.isP3attacks() && versikCounter > 0 && versikCounter < 8)
{
String str = Math.max(versikCounter, 0) + "";// + " | " + model.getModelHeight();// + " | " + model.getRadius();
@@ -148,23 +138,16 @@ public class VerzikHandler extends RoomHandler
renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point);
}
}
}
}
if (plugin.isVerzikTankTile())
{
if (id == TheatreConstant.VERZIK_ID_P3)
if (plugin.isVerzikTankTile() && id == TheatreConstant.VERZIK_ID_P3)
{
WorldPoint wp = new WorldPoint(npc.getWorldLocation().getX() + 3, npc.getWorldLocation().getY() + 3, client.getPlane());
drawTile2(graphics, wp, new Color(75, 0, 130), 2, 255, 0);
//renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0);
}
}
if (plugin.isShowVerzikYellows())
{
if (this.yellows > 0)
if (plugin.isShowVerzikYellows() && this.yellows > 0)
{
String text = Integer.toString(this.yellows);
@@ -179,7 +162,6 @@ public class VerzikHandler extends RoomHandler
}
}
}
}
if (plugin.isShowCrabTargets())
{
@@ -336,13 +318,10 @@ public class VerzikHandler extends RoomHandler
this.yellows--;
}
if (npc != null)
{
if (npc.getAnimation() == 8117)
if (npc != null && npc.getAnimation() == 8117)
{
redCrabsTimer = redCrabsTimer - 1;
}
}
boolean foundVerzik = false;

View File

@@ -95,13 +95,10 @@ public class NyloHandler extends RoomHandler
long minutes = seconds / 60L;
seconds = seconds % 60;
if (this.startTime != 0)
{
if (plugin.isExtraTimers())
if (this.startTime != 0 && plugin.isExtraTimers())
{
this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' completed! Duration: <col=ff0000>" + minutes + ":" + twoDigitString(seconds), null);
}
}
System.out.println("Stopping Nylocas Room");
}
@@ -267,9 +264,7 @@ public class NyloHandler extends RoomHandler
this.pillars.put(npc, 100);
this.recalculateLocal();
}
else if (npc.getName() != null)
{
if (this.plugin.getRoom() == TheatreRoom.NYLOCAS)
else if (npc.getName() != null && this.plugin.getRoom() == TheatreRoom.NYLOCAS)
{
Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)");
Matcher m = p.matcher(npc.getName());
@@ -288,7 +283,6 @@ public class NyloHandler extends RoomHandler
}
}
}
}
public void onNpcDespawned(NpcDespawned event)
{

View File

@@ -158,9 +158,9 @@ public class XarpusHandler extends RoomHandler
public void onVarbitChanged(VarbitChanged event)
{
if (client.getVar(Varbits.MULTICOMBAT_AREA) == 1 || client.getVarbitValue(client.getVarps(), TheatreConstant.DOOR_VARP) == 2)
{
if (!xarpusFlag)
if ((client.getVar(Varbits.MULTICOMBAT_AREA) == 1 ||
client.getVarbitValue(client.getVarps(), TheatreConstant.DOOR_VARP) == 2) &&
!xarpusFlag)
{
int players = client.getPlayers().size();
@@ -188,7 +188,6 @@ public class XarpusHandler extends RoomHandler
xarpusFlag = true;
}
}
}
public void onNpcSpawned(NpcSpawned event)
{