Skip to content

Entity#getTrackedBy includes players whose tracking was cancelled #14280

Description

@roccodev

Expected behavior

When cancelling PlayerTrackEntityEvent, subsequent calls to Entity#getTrackedBy on the entity and player involved would not include the player, i.e. Entity#isTrackedBy would return false.

Observed/Actual behavior

When cancelling PlayerTrackEntityEvent, calls to Entity#getTrackedBy while the entity is still in range of the player include the player in the result, and Entity#isTrackedBy also returns true for the same pair.

Steps/models to reproduce

  • Register a listener for PlayerTrackEntityEvent that cancels the event
  • Subsequently, check Entity#isTrackedBy on the same entity and player.

Note that the event works correctly in that the player can't see the entity after it's cancelled.

Plugin and Datapack List

None

Paper version

Checking version, please wait...
This server is running Paper version 26.2-121-main@a2a42c5 (2026-08-29T11:32:25Z) (Implementing API version 26.2.build.121-stable)
You are 2 version(s) behind
Previous version: 26.2-DEV-acd0ad4 (MC: 26.2)

Other

This occurs because the player is still in the seenBy set in ChunkMap.TrackedEntity, presumably so that the event doesn't fire multiple times? However, that is also the set checked by the entity methods.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions