Merge pull request #6244 from deathbeam/idle-notifier-fixes

Properly update last action times in Idle Notifier
This commit is contained in:
Tomas Slusny
2018-11-03 12:44:30 +01:00
committed by GitHub
2 changed files with 12 additions and 5 deletions

View File

@@ -214,19 +214,23 @@ public class IdleNotifierPlugin extends Plugin
case SAND_COLLECTION:
resetTimers();
lastAnimation = animation;
lastAnimating = Instant.now();
break;
case MAGIC_LUNAR_SHARED:
if (graphic == GraphicID.BAKE_PIE)
{
resetTimers();
lastAnimation = animation;
lastAnimating = Instant.now();
break;
}
case IDLE:
lastAnimating = Instant.now();
break;
default:
// On unknown animation simply assume the animation is invalid and dont throw notification
lastAnimation = IDLE;
lastAnimating = null;
}
}
@@ -246,6 +250,10 @@ public class IdleNotifierPlugin extends Plugin
{
lastInteract = null;
}
else
{
lastInteracting = Instant.now();
}
final boolean isNpc = target instanceof NPC;
@@ -264,6 +272,7 @@ public class IdleNotifierPlugin extends Plugin
// Player is most likely in combat with attack-able NPC
resetTimers();
lastInteract = target;
lastInteracting = Instant.now();
}
}
@@ -447,7 +456,9 @@ public class IdleNotifierPlugin extends Plugin
if (interact == null)
{
if (lastInteracting != null && Instant.now().compareTo(lastInteracting.plus(waitDuration)) >= 0)
if (lastInteracting != null
&& Instant.now().compareTo(lastInteracting.plus(waitDuration)) >= 0
&& lastCombatCountdown == 0)
{
lastInteract = null;
lastInteracting = null;
@@ -553,9 +564,6 @@ public class IdleNotifierPlugin extends Plugin
{
final Player local = client.getLocalPlayer();
// Reset combat idle timer
lastCombatCountdown = 0;
// Reset animation idle timer
lastAnimating = null;
if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getAnimation() != lastAnimation)

View File

@@ -155,7 +155,6 @@ public class IdleNotifierPluginTest
AnimationChanged animationChanged = new AnimationChanged();
animationChanged.setActor(player);
plugin.onAnimationChanged(animationChanged);
plugin.onInteractingChanged(new InteractingChanged(player, monster));
plugin.onGameTick(new GameTick());
// Logout