Reload re-imports control panels from the template file#41
Open
tastybento wants to merge 1 commit into
Open
Conversation
Control panels were pinned to the database after the first seed, so editing controlPanelTemplate.yml and running 'bbox reload' had no effect: onReload only re-read the database. The only way to apply template edits was the confirmation-gated admin import command. onReload now wipes and re-imports each active game mode from the template so plain reloads pick up edits. The template file name is configurable via a new 'template-file' entry in config.yml (default controlPanelTemplate.yml), honored by reload, importControlPanels, and the admin import command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0118vFoM1ejLPLUGdz4sLunb
|
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.



Problem
Reported on Discord: after editing
controlPanelTemplate.ymland runningbbox reload— with no errors — the control panel doesn't pick up the new configuration.Root cause: panels are stored in BentoBox's database, and the template file is only a one-time seed.
onReload()→manager.reload()re-read only the database, so template edits were silently ignored. The only way to apply them was the confirmation-gated/<gamemode>admin cp importcommand.Change
onReload()now wipes and re-imports each active game mode's panels from the template, so a plainbbox reloadapplies edits. Wiping first ensures panels removed from the template also disappear rather than lingering in the DB.template-fileentry inconfig.yml(defaultcontrolPanelTemplate.yml), honored by reload,importControlPanels, and the adminimportcommand. Point it at your own file and both reload andcp importuse it.Tests
102 pass (was 99). Added:
SettingsTest— default value + setter fortemplateFile.ControlPanelManagerTest— reimport reads the template, wipes deleted panels, and honors a custom configured filename.🤖 Generated with Claude Code