Fix entity counts drifting after server restart#270
Merged
Conversation
Member
|
Fantastic! Thanks! |
This was referenced Jun 29, 2026
Merged
daniel-skopek
pushed a commit
to daniel-skopek/Limits
that referenced
this pull request
Jul 5, 2026
…h tests Follow-up to BentoBoxWorld#270. Now that onEntityAddToWorld re-populates entityIslandMap on chunk reload, entries can safely be dropped on chunk unload — previously they were retained because nothing rebuilt them, which (after BentoBoxWorld#270 mapped every loaded entity) let the map grow unbounded for entities that never reload. onEntityRemove now removes the UUID on the UNLOAD cause. Also drops the no-op ignoreCancelled on the onEntityAddToWorld handler (EntityAddToWorldEvent is not Cancellable) and adds JUnit coverage for the new handler and the eviction: - map population for loaded living entities - non-tracked entities, non-game-mode worlds and spawn islands skipped - already-mapped entities skipped without a redundant getIslandAt lookup - UNLOAD evicts the mapping without decrementing the count - a reloaded entity that dies off-island still decrements (the BentoBoxWorld#270 bug) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
entityIslandMap was transient — lost on every restart. Entities loaded
from chunks never re-entered it, so off-island deaths/despawns failed to
decrement. Added EntityAddToWorldEvent handler to repopulate the map.