Release 3.17.0#2986
Merged
Merged
Conversation
…perience, money, and tamed entities
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a cancellable “player reset” event family and wires it into PlayersManager#cleanLeavingPlayer, allowing addons to selectively veto specific reset actions (tamed entities, ender chest, inventory, money, health, hunger, XP) when a player leaves/is removed from an island. It also bumps the project version to 3.17.0.
Changes:
- Add
PlayerBaseEventplus specific reset events and aPlayerEventbuilder/factory for firing them. - Update
PlayersManager#cleanLeavingPlayerto fire a cancellable event before each reset action and skip the action when cancelled. - Add/extend unit tests to cover event construction and cancellation behavior.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
build.gradle.kts |
Bumps build version to 3.17.0. |
src/main/java/world/bentobox/bentobox/managers/PlayersManager.java |
Fires cancellable reset events before each on-leave reset action. |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerBaseEvent.java |
Introduces cancellable base event for player reset events. |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerEvent.java |
Adds builder/factory to construct and call the specific reset events. |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetEnderChestEvent.java |
New reset event type (ender chest). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetExpEvent.java |
New reset event type (XP). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetHealthEvent.java |
New reset event type (health). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetHungerEvent.java |
New reset event type (hunger). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetInventoryEvent.java |
New reset event type (inventory), includes HandlerList. |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerResetMoneyEvent.java |
New reset event type (money). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerTamedRemovalEvent.java |
New reset event type (tamed entity removal). |
src/main/java/world/bentobox/bentobox/api/events/player/PlayerUnknownEvent.java |
New fallback reset event type (unknown). |
src/test/java/world/bentobox/bentobox/managers/PlayersManagerTest.java |
Adds tests asserting cancellation blocks each reset action. |
src/test/java/world/bentobox/bentobox/api/events/player/PlayerResetEventsTest.java |
Adds construction/cancellation tests for the new event family. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.



…perience, money, and tamed entities