Skip to content

Fire PlayerDeathsChangedEvent from admin deaths commands - #3093

Merged
tastybento merged 1 commit into
developfrom
feature/admin-deaths-event
Sep 26, 2026
Merged

tastybento merged 1 commit into
developfrom
feature/admin-deaths-event

Conversation

@tastybento

Copy link
Copy Markdown
Member

Why

Since Level 2.29.0, Level tracks death handicaps per island in its own data instead of reading BentoBox's per-world player counter. As a result, /bsbadmin deaths set|add|remove|reset changes BentoBox's counter but has no effect on island levels (reported on Discord: an admin removed 3 deaths, and /is level still showed (3 deaths)). Rather than duplicating the command in Level, core should tell addons when an admin changes deaths.

What

  • New world.bentobox.bentobox.api.events.player.PlayerDeathsChangedEvent (@since 3.23.1): world, player UUID, Action (SET/ADD/REMOVE/RESET), the amount the admin requested, and old/new counts.
  • Fired after the change by the four admin deaths subcommands only. Not fired for natural deaths or for the automatic resets on new island / team join.
  • getAmount() is the requested amount, so remove 3 is reported as 3 even when core's count is clamped at 0. Addons with their own counts need this.
  • Tests: AdminDeathsCommandsTest checks each command fires the event with the right values, and that invalid input fires nothing.

Level side: companion PR in BentoBoxWorld/Level (follows).

🤖 Generated with Claude Code

Addons that keep their own death counts (Level tracks deaths per island
since 2.29.0) had no way to know when an admin changed a player's deaths,
so /<admin> deaths set|add|remove|reset silently did nothing to them.

The four admin deaths commands now fire PlayerDeathsChangedEvent with the
world, player, action, requested amount, and old/new counts. It is not
fired for natural deaths or the automatic new-island/team-join resets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 0641027 into develop Sep 26, 2026
3 checks passed
@tastybento
tastybento deleted the feature/admin-deaths-event branch September 26, 2026 15:47
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