idlenotifier: Correctly warn about AFK kicking

This commit is contained in:
Max Weber
2018-09-15 01:24:27 -06:00
parent d2aeed2e1d
commit f117ac082a
2 changed files with 49 additions and 26 deletions

View File

@@ -231,8 +231,8 @@ public class IdleNotifierPluginTest
@Test
public void checkCombatLogoutIdle()
{
// Player is idle
when(client.getMouseLastPressedMillis()).thenReturn(System.currentTimeMillis() - 300_000L);
// Player is idle
when(client.getMouseIdleTicks()).thenReturn(80_000);
// But player is being damaged (is in combat)
final HitsplatApplied hitsplatApplied = new HitsplatApplied();
@@ -242,4 +242,18 @@ public class IdleNotifierPluginTest
plugin.onGameTick(new GameTick());
verify(notifier, times(0)).notify(any());
}
@Test
public void doubleNotifyOnMouseReset()
{
// Player is idle, but in combat so the idle packet is getting set repeatedly
// make sure we are not notifying
when(client.getKeyboardIdleTicks()).thenReturn(80_000);
when(client.getMouseIdleTicks()).thenReturn(14_500);
plugin.onGameTick(new GameTick());
plugin.onGameTick(new GameTick());
verify(notifier, times(1)).notify(any());
}
}