Direct answer
A fixed RegionScheduler location can become stale when a player, mob or NPC moves. The EntityScheduler is attached to the entity and schedules on its current owning region, making it the correct API choice for later entity interactions.
How to check it
- Identify every deferred callback that reads or changes a moving entity (teleport follow-ups, potion effects, health, inventory or NPC actions).
- Check whether code stores only a Location and later assumes the entity remains in that same region.
- Test entity removal and teleportation while tasks are pending; handle a retired entity or cancelled task instead of assuming the entity will always be present.
What to change
Retrieve the scheduler from the entity rather than a world coordinate:
EntityScheduler scheduler = entity.getScheduler();
// Schedule work using the API methods for your target build.Use the scheduler’s supported task methods with their documented retirement behavior, and do not call unsafe entity operations from a generic async callback.
Use teleportAsync where appropriate instead of treating cross-region teleports as immediate synchronous moves.
The EntityScheduler is a developer API concept, not a setting that server owners can enable in a YAML file. Method signatures may differ among API versions; compile against your target server API.
Software and version notes
These are Folia architectural and API concepts; test against the exact Folia and Paper API build you deploy. Do not apply generic Paper single-thread assumptions.
Verify the result
After the task runs, verify it affected the correct entity during movement/teleportation and emitted no Folia ownership exceptions.