Skip to content

Commit ce9b170

Browse files
tastybentoclaude
andcommitted
Don't clear gamemode addon placeholders on reload
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>
1 parent 4741603 commit ce9b170

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/world/bentobox/bentobox/commands/BentoBoxReloadCommand.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ public boolean execute(User user, String label, List<String> args) {
3939
if (args.isEmpty()) {
4040
this.askConfirmation(user, user.getTranslation("commands.bentobox.reload.warning"), () -> {
4141

42-
// Clear placeholders that this reload will rebuild. Addon-owned
43-
// placeholders (e.g. from the Level addon) are intentionally
44-
// preserved because reload does not re-invoke addons (#2930).
42+
// Clear only BentoBox-core placeholders. Addon-owned placeholders
43+
// (both gamemode defaults and any custom ones addons register
44+
// themselves) are intentionally preserved because reload does
45+
// not re-invoke addons (#2930). registerDefaultPlaceholders
46+
// below is idempotent, so any newly-added flag placeholders
47+
// will still be picked up.
4548
PlaceholdersManager pm = getPlugin().getPlaceholdersManager();
4649
pm.unregisterAll();
47-
getPlugin().getAddonsManager().getGameModeAddons().forEach(pm::unregisterAll);
4850

4951
// Close all open panels
5052
PanelListenerManager.closeAllPanels();

0 commit comments

Comments
 (0)