Skip to content

Zone reward countdown (EzCountdown) never stops when the player stops being AFK or leaves the zone #54

Open

Description

@manoakys

Description

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

  1. Enable reward.notification.enabled: true for an AFK zone.
  2. Go AFK inside that zone and wait for the countdown to appear.
  3. 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).

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions