Entity#getTrackedBy includes players whose tracking was cancelled
Author: roccodevCreated Sep 19, 2026Updated Sep 19, 2026
Labelsstatus: needs triageversion: 26.2
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
PlayerTrackEntityEventthat cancels the event - Subsequently, check
Entity#isTrackedByon 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.
Source: PaperMC/Paper