From ce9b170d52ae0439722fb0da111e953e1fb0f65c Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 8 Apr 2026 22:36:46 -0700 Subject: [PATCH] Don't clear gamemode addon placeholders on reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../bentobox/commands/BentoBoxReloadCommand.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/commands/BentoBoxReloadCommand.java b/src/main/java/world/bentobox/bentobox/commands/BentoBoxReloadCommand.java index 743794d20..68cb83e83 100644 --- a/src/main/java/world/bentobox/bentobox/commands/BentoBoxReloadCommand.java +++ b/src/main/java/world/bentobox/bentobox/commands/BentoBoxReloadCommand.java @@ -39,12 +39,14 @@ public boolean execute(User user, String label, List args) { if (args.isEmpty()) { this.askConfirmation(user, user.getTranslation("commands.bentobox.reload.warning"), () -> { - // Clear placeholders that this reload will rebuild. Addon-owned - // placeholders (e.g. from the Level addon) are intentionally - // preserved because reload does not re-invoke addons (#2930). + // Clear only BentoBox-core placeholders. Addon-owned placeholders + // (both gamemode defaults and any custom ones addons register + // themselves) are intentionally preserved because reload does + // not re-invoke addons (#2930). registerDefaultPlaceholders + // below is idempotent, so any newly-added flag placeholders + // will still be picked up. PlaceholdersManager pm = getPlugin().getPlaceholdersManager(); pm.unregisterAll(); - getPlugin().getAddonsManager().getGameModeAddons().forEach(pm::unregisterAll); // Close all open panels PanelListenerManager.closeAllPanels();