Don't clear gamemode addon placeholders on reload (#2930 follow-up)#2932
Merged
tastybento merged 1 commit intodevelopfrom Apr 9, 2026
Merged
Don't clear gamemode addon placeholders on reload (#2930 follow-up)#2932tastybento merged 1 commit intodevelopfrom
tastybento merged 1 commit intodevelopfrom
Conversation
Clearing each gamemode's placeholders wiped out custom placeholders the gamemode addon registered itself (e.g. AOneBlock's own %aoneblock_...% placeholders), which registerDefaultPlaceholders does not rebuild. registerDefaultPlaceholders is already idempotent — BasicPlaceholderExpansion uses putIfAbsent, and registerFlagPlaceholder early-returns via isPlaceholder — so running it without pre-clearing simply adds any missing entries and leaves existing ones alone. Co-Authored-By: Claude Opus 4.6 <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.



Summary
Follow-up to #2931. A user reported that after the first fix,
%level_...%placeholders survive/bbox reloadbut AOneBlock's own%aoneblock_...%placeholders still break.Root cause: the first fix still cleared each gamemode addon's placeholder map before re-running
registerDefaultPlaceholders. That wiped out any custom placeholders a gamemode addon registered for itself (beyond the BentoBox defaults), whichregisterDefaultPlaceholdershas no way to rebuild.registerDefaultPlaceholdersis already idempotent —BasicPlaceholderExpansion.registerPlaceholderusesputIfAbsent, andregisterFlagPlaceholderearly-returns viaisPlaceholder— so running it without pre-clearing simply adds any missing entries (e.g. newly-registered flag placeholders) and leaves existing ones alone.This PR removes the per-addon clear loop from
BentoBoxReloadCommand.PlaceholderAPIHook.unregisterAll()now really does only touch the BentoBox-core expansion, as intended.Test plan
./gradlew test --tests "world.bentobox.bentobox.managers.PlaceholdersManagerTest"%aoneblock_island_name%and%level_aoneblock_island_level%. Run/bbox reloadand confirm both still resolve.🤖 Generated with Claude Code