Skip to content

feat: track death handicap per island instead of per world - #456

Merged
tastybento merged 1 commit into
masterfrom
feat/per-island-deaths
Aug 1, 2026
Merged

feat: track death handicap per island instead of per world#456
tastybento merged 1 commit into
masterfrom
feat/per-island-deaths

Conversation

@tastybento

Copy link
Copy Markdown
Member

Problem

Level read death counts from BentoBox core's per-player, per-world counter (Players.deaths) at calculation time. Now that players can have multiple islands and join teams while keeping their own islands, this caused:

  • A player joining a team immediately raised the team island's death handicap with their entire world death history (core's team-join-reset only fires when the joiner's own islands are deleted on join, i.e. when disallowTeamMemberIslands is true).
  • reset-on-new-island zeroed the whole world count, wiping the deaths that were effectively counting against the player's other islands in that world.
  • All of a player's islands in a world shared one death count, and deaths anywhere in the world counted — even while visiting someone else's island.

Reported on Discord by mrFloris/chunkblock.

Solution

Level now tracks deaths itself, per island, stored in IslandLevels:

  • A death only counts if it happens in the island space of an island the dying player is a member of. Deaths in other worlds or on other people's islands are ignored. Core's deaths.counted and deaths.max game mode settings are honoured.
  • Per-player counts are kept so the admin level report can show who died; each is capped at the game mode's deaths.max.
  • When a member leaves or is kicked, their balance is folded into a per-island anonymous death count — an island's handicap never decreases just because an often-dying member left. Leave-and-rejoin does not double count.
  • Island reset/deletion clears the island's death data, giving per-island reset-on-new-island semantics with no config needed.
  • Team join carries nothing over, regardless of core settings.

Migration

Legacy per-world counts are migrated once per island, on first touch (calculation, death, or member departure — whichever comes first). The seed reproduces exactly what the old formula would compute at that moment (sum of member deaths if sumteamdeaths, else owner deaths) and is stored as anonymous deaths, so island levels do not change on upgrade.

sumteamdeaths is deprecated and only read for the migration seed; the new model always counts all deaths that occurred on the island.

Notes for admins

  • Core's /[admin] deaths set|add|reset commands and the team-join-reset / reset-on-new-island settings no longer influence island levels (core's counter is untouched and still drives core placeholders).
  • The level report now breaks the handicap down per member by name, with a labelled line for former-member/migrated deaths.

Tests

New coverage for: migration seeding in both sumteamdeaths modes (and no re-seed on second call), death cap and deaths.max: 0, member/non-member/off-island/non-game-world deaths, leave/kick rollover preserving the island total, and the handicap reducing the level in tidyUp(). Full suite: 256 tests, all passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NSvRYW3Rgh6Vgvx62QRYE1

Deaths were read from BentoBox's per-player, per-world counter at
calculation time, which caused several problems now that players can
have multiple islands and join teams while keeping their own islands:

- A player joining a team immediately raised the team island's death
  handicap with deaths from their entire world history (core's
  team-join-reset only fires when team members' own islands are
  deleted on join).
- reset-on-new-island zeroed the whole world count, wiping deaths
  that were effectively counting against the player's other islands.
- Deaths anywhere in the world counted, even while visiting someone
  else's island.

Deaths are now recorded by Level itself, per island, in IslandLevels:

- A death only counts if it happens in the island space of an island
  the player is a member of. Deaths elsewhere are ignored.
- Per-player counts are kept for the admin level report ("who died"),
  capped at the game mode's deaths max setting.
- When a member leaves or is kicked, their balance is folded into an
  anonymous per-island count, so an island's handicap never decreases
  just because an often-dying member left. Island reset/deletion
  clears everything, giving per-island reset-on-new-island semantics.
- Legacy per-world counts are migrated once per island on first touch:
  the seed reproduces exactly what the old formula would compute now
  (sum of member deaths if sumteamdeaths, else owner deaths) and is
  stored as anonymous deaths, so levels do not change at upgrade.
- sumteamdeaths is deprecated; it is only read for the migration seed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSvRYW3Rgh6Vgvx62QRYE1
@sonarqubecloud

sonarqubecloud Bot commented Aug 1, 2026

Copy link
Copy Markdown

@tastybento
tastybento merged commit ae6a72d into master Aug 1, 2026
3 checks passed
@tastybento
tastybento deleted the feat/per-island-deaths branch August 1, 2026 17:57
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.

1 participant