flinchingplugin: Merge nested if statements
This commit is contained in:
@@ -198,12 +198,9 @@ public class FlinchingPlugin extends Plugin
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlinchingTarget currentTarget = flinchingTargets.get(hitId);
|
FlinchingTarget currentTarget = flinchingTargets.get(hitId);
|
||||||
if (currentTarget != null)
|
if (currentTarget != null && resetOnHit)
|
||||||
{
|
{
|
||||||
if (resetOnHit)
|
currentTarget.TargetHit();
|
||||||
{
|
|
||||||
currentTarget.TargetHit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,13 +221,10 @@ public class FlinchingPlugin extends Plugin
|
|||||||
NPC newTarget = (NPC) interacting;
|
NPC newTarget = (NPC) interacting;
|
||||||
currentInteractingId = newTarget.getId();
|
currentInteractingId = newTarget.getId();
|
||||||
|
|
||||||
if (newTarget.getHealth() <= 0 || newTarget.isDead())
|
if ((newTarget.getHealth() <= 0 || newTarget.isDead()) && flinchingTargets.containsKey(currentInteractingId))
|
||||||
{
|
{
|
||||||
if (flinchingTargets.containsKey(currentInteractingId))
|
flinchingTargets.remove(currentInteractingId);
|
||||||
{
|
currentInteractingId = -1;
|
||||||
flinchingTargets.remove(currentInteractingId);
|
|
||||||
currentInteractingId = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,12 +63,9 @@ public class FlinchingTarget
|
|||||||
void TargetHit()
|
void TargetHit()
|
||||||
{
|
{
|
||||||
boolean shouldHit = true;
|
boolean shouldHit = true;
|
||||||
if (usingHitDelay)
|
if (usingHitDelay && GetRemainingTime() > displayLength)
|
||||||
{
|
{
|
||||||
if (GetRemainingTime() > displayLength)
|
shouldHit = false;
|
||||||
{
|
|
||||||
shouldHit = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldHit)
|
if (shouldHit)
|
||||||
|
|||||||
Reference in New Issue
Block a user