Skip to content

Don't clear gamemode addon placeholders on reload (#2930 follow-up)#2932

Merged
tastybento merged 1 commit intodevelopfrom
fix/2930-placeholder-reload-followup
Apr 9, 2026
Merged

Don't clear gamemode addon placeholders on reload (#2930 follow-up)#2932
tastybento merged 1 commit intodevelopfrom
fix/2930-placeholder-reload-followup

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

Follow-up to #2931. A user reported that after the first fix, %level_...% placeholders survive /bbox reload but 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), which registerDefaultPlaceholders has no way to rebuild.

registerDefaultPlaceholders is already idempotent — BasicPlaceholderExpansion.registerPlaceholder uses putIfAbsent, and registerFlagPlaceholder early-returns via isPlaceholder — 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"
  • Manual: install BentoBox + AOneBlock + Level + PlaceholderAPI on Paper. Display both %aoneblock_island_name% and %level_aoneblock_island_level%. Run /bbox reload and confirm both still resolve.

🤖 Generated with Claude Code

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>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

@tastybento tastybento merged commit 40d611d into develop Apr 9, 2026
3 checks passed
@tastybento tastybento deleted the fix/2930-placeholder-reload-followup branch April 9, 2026 05:42
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