You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Zone reward countdown (EzCountdown) never stops when the player stops being AFK or leaves the zone #54
The zone reward countdown (the "Next AFK Key in ..." bar) keeps running after the player stops being AFK or walks out of the AFK zone. It counts down to 0 and then disappears. No reward is given, because rewards only go to AFK players inside the zone, but the bar is misleading: a player standing at their base still sees a timer and thinks they are earning a key.
Environment
EzAfk: 3.1.2
EzCountdown: 2.0.2
Server: Paper 1.21.11
Steps to reproduce
Enable reward.notification.enabled: true for an AFK zone.
Go AFK inside that zone and wait for the countdown to appear.
Move (un-AFK) and walk out of the zone.
Expected behavior
The countdown disappears as soon as the player is no longer AFK in the zone.
Actual behavior
The countdown keeps running until it reaches 0 (up to the full reward interval), or until the player relogs.
Analysis (from reading the source)
stopAllZoneCountdowns is only called from PlayerQuitListener, on reload/shutdown, and when the player is AFK in a zone with rewards turned off.
processRewards only stops a countdown when zone != null, so un-AFK and leaving the zone never stop it.
Related: AfkZoneRewardManager.states is only cleared on quit, so after /ezafk reload the countdown is not restarted until the next payout.
Suggested fix
Stop the player's zone countdown when they leave AFK or leave the zone (not only on quit), and clear/rebuild states on reload.
Workaround
Set notification.enabled: false in zones.yml (players lose the timer, rewards still work).
Activity