Skip to content

Fix entity counts drifting after server restart#270

Merged
tastybento merged 1 commit into
BentoBoxWorld:developfrom
daniel-skopek:develop
Jun 29, 2026
Merged

Fix entity counts drifting after server restart#270
tastybento merged 1 commit into
BentoBoxWorld:developfrom
daniel-skopek:develop

Conversation

@daniel-skopek

Copy link
Copy Markdown
Contributor

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.

@tastybento tastybento merged commit 1ff20a6 into BentoBoxWorld:develop Jun 29, 2026
1 check failed
@tastybento

Copy link
Copy Markdown
Member

Fantastic! Thanks!

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants