whalewatchers: Merge nested if statements

This commit is contained in:
sdburns1998
2019-07-07 21:54:17 +02:00
parent 9ed6759c83
commit 9764fac996

View File

@@ -98,14 +98,11 @@ public class WhaleWatchersPlugin extends Plugin
@Subscribe @Subscribe
public void onOverlayMenuClicked(OverlayMenuClicked event) public void onOverlayMenuClicked(OverlayMenuClicked event)
{ {
if (event.getOverlay().equals(overlay)) if (event.getOverlay().equals(overlay) && event.getEntry().getOption().equals("Reset"))
{
if (event.getEntry().getOption().equals("Reset"))
{ {
resetDamageCounter(); resetDamageCounter();
} }
} }
}
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
@@ -207,16 +204,10 @@ public class WhaleWatchersPlugin extends Plugin
@Subscribe @Subscribe
public void onVarbitChanged(VarbitChanged event) public void onVarbitChanged(VarbitChanged event)
{ {
if (this.showDamageCounter) if (this.showDamageCounter && client.getVar(VarPlayer.ATTACKING_PLAYER) == -1 && inCombat)
{
if (client.getVar(VarPlayer.ATTACKING_PLAYER) == -1)
{
if (inCombat)
{ {
tickCountdown = 10; tickCountdown = 10;
} }
}
}
if (this.protectItemWarning) if (this.protectItemWarning)
{ {
@@ -254,9 +245,7 @@ public class WhaleWatchersPlugin extends Plugin
@Subscribe @Subscribe
public void onGameTick(GameTick event) public void onGameTick(GameTick event)
{ {
if (this.showDamageCounter) if (this.showDamageCounter && tickCountdown > 0 && tickCountdown < 11)
{
if (tickCountdown > 0 && tickCountdown < 11)
{ {
tickCountdown--; tickCountdown--;
if (tickCountdown == 1) if (tickCountdown == 1)
@@ -266,7 +255,6 @@ public class WhaleWatchersPlugin extends Plugin
return; return;
} }
} }
}
if (this.smiteableWarning && (client.getVar(Varbits.IN_WILDERNESS) == 1 || isPvpWorld(client.getWorldType()))) if (this.smiteableWarning && (client.getVar(Varbits.IN_WILDERNESS) == 1 || isPvpWorld(client.getWorldType())))
{ {
if (client.getLocalPlayer().getSkullIcon() != null && client.getLocalPlayer().getSkullIcon().equals(SkullIcon.SKULL)) if (client.getLocalPlayer().getSkullIcon() != null && client.getLocalPlayer().getSkullIcon().equals(SkullIcon.SKULL))