feat: add admin range bonus management commands (removebonus + purgebonus)#2988
Merged
Conversation
Adds AdminRangeRemoveBonusCommand under `/<admin> range removebonus <player> [id]`, a confirmable command for clearing bonus ranges stored on an island as BonusRangeRecords (typically granted by addons). - With no id: removes every bonus range from the player's island. - With an id: removes only the bonus ranges for that unique id. - Tab completion offers the island's existing bonus-range ids so the admin does not have to guess them. - Fires an IslandEvent RANGE_CHANGE if the effective protection range changed. The island is persisted via setChanged() (no explicit save). Registers the subcommand in AdminRangeCommand, adds the commands.admin.range.removebonus.* locale keys to en-US and translations to all 22 other bundled locales, and bumps the build version to 3.17.1. Adds AdminRangeRemoveBonusCommandTest (13 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds AdminRangePurgeBonusCommand under `/<admin> range purgebonus <id>`, a confirmable command that removes every bonus range carrying a given id from ALL islands in the gamemode's world. Addons tag the bonus ranges they grant with their own name (the bonus uniqueId) - e.g. the Upgrades addon stores them under "Upgrades". When such an addon is uninstalled its bonus ranges linger on every island it touched; this command purges them in one pass. - Iterates the island cache so the live, canonical island instances are mutated (clearBonusRange -> setChanged persists each changed island). - Fires an IslandEvent RANGE_CHANGE per island whose effective protection range changed. - Warns how many islands will be affected before confirmation. - Tab completion lists the bonus ids present on loaded islands so the admin doesn't have to guess them. Registers the subcommand, adds commands.admin.range.purgebonus.* locale keys to en-US and translations to all 22 other bundled locales, and adds AdminRangePurgeBonusCommandTest (7 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reworks AdminRangePurgeBonusCommand so the potentially heavy island scan
no longer blocks the main thread on large servers, following the
established purge-command pattern.
- The scan that finds islands carrying the bonus id now runs off-thread
via IslandsManager#getIslandsASync(); results are marshalled back to
the main thread to prompt and to apply.
- Confirmation is now explicit: `/<admin> range purgebonus <id>` scans
and reports the count, then `/<admin> range purgebonus <id> confirm`
applies it (reusing the scanned result - no second scan). An inPurge
guard rejects overlapping runs.
- The mutation and IslandEvent RANGE_CHANGE firing still happen on the
main thread, on the live cached island instances (resolved by id),
with per-island re-check in case state changed since the scan.
Adds locale keys commands.admin.range.purgebonus.{confirm,in-progress,
failed} to en-US and all 22 other locales. Rewrites the test suite (12
tests) to cover the sync seams: findIslandIds, applyPurge, the confirm
dispatch, canExecute guards and tab completion.
Co-Authored-By: Claude Opus 4.8 <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.



What
Adds two admin commands for managing the bonus ranges stored on islands. Bonus ranges are static values added to (or subtracted from) an island's protection range, stored as
BonusRangeRecords. Addons tag the ones they grant with their own addon name as the bonusuniqueId(e.g. the Upgrades addon uses"Upgrades"), so admins need a way to clear them — most importantly after the granting addon has been uninstalled.Commands
/<admin> range removebonus <player> [id](confirmable)Operates on a single player's island.
/<admin> range purgebonus <id>→… <id> confirmRemoves the bonus id from every island in the gamemode's world — the "addon was uninstalled, purge its bonus everywhere" workflow.
IslandsManager#getIslandsASync(), so it won't freeze a large server. It reports the affected-island count, then you re-run withconfirmto apply (reusing the scanned result — no second scan). AninPurgeguard rejects overlapping runs.RANGE_CHANGEevent firing happen back on the main thread, on the live cached island instances (resolved by id), with a per-island re-check in case state changed since the scan.Both commands fire
IslandEventRANGE_CHANGEwhen an island's effective protection range actually changes. Persistence is viasetChanged(), consistent with the existingrange add/resetcommands.Changes
AdminRangeRemoveBonusCommandandAdminRangePurgeBonusCommand, registered inAdminRangeCommand.commands.admin.range.{removebonus,purgebonus}.*added toen-US.ymland translated into all 22 other bundled locales.3.17.0→3.17.1.AdminRangeRemoveBonusCommandTest(13) +AdminRangePurgeBonusCommandTest(12).Testing
./gradlew buildpasses — full test suite + all 23 locale files parse. New suites: 25/25 green.🤖 Generated with Claude Code