Template-editable Command Ranks panel (#3095) - #3096
Merged
Merged
Conversation
The Command Ranks panel, opened from the COMMAND_RANKS flag, is now laid out by panels/command_ranks_panel.yml. The template is installed to the BentoBox data folder, and a game mode can override it with its own copy. - New CommandRanksPanel with COMMAND (paged command list), NEXT and PREVIOUS button types. A command button can override the icon, the name layout and the lore layout; tooltips are appended. - The default template reproduces the old look (map icons, no filler, rows sized to fit), and pages at 45 instead of silently dropping every command after the 49th. - CommandRankClickListener opens it through the game mode's player command and keeps the old PanelBuilder layout as the fallback when there is none or the template can't be loaded. getCommands and a template-aware getPanelItemBuilder are now public. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SonarCloud flagged duplicated lines on #3096: - SettingsPanel and CommandRanksPanel carried the same lifecycle code (refresh after every click, close tracking, click cooldown, actionable slots, game mode template lookup). It now lives in AbstractRefreshingPanel, which both extend. Subclasses supply prepareRefresh(), and optionally titleParameters() and onClosed(); SettingsPanel's deferred island saves end in onClosed(). Inserting the superclass keeps SettingsPanel binary compatible. - BentoBox.loadSettings wrote each default panel template with its own copy of the same block; it now loops over DEFAULT_PANELS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Pushed 02227a7 to fix the SonarCloud duplication (27 new duplicated lines, 4.9%):
Full suite still 3581 / 0 failures. 🤖 Generated with Claude Code |
|
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.



Closes #3095, a follow-up to #3092.
The Command Ranks panel, opened from the
COMMAND_RANKSflag in/island settings, is now laid out by a panel template, as the settings panel has been since #3081.Template
panels/command_ranks_panel.ymlis installed to the BentoBox data folder on startup. A game mode's ownpanels/command_ranks_panel.ymltakes precedence for that game mode.COMMAND— one slot of the paged list of rank-configurable commands. The template button can seticon(defaultMAP),title(name layout, with[name]) anddescription(lore layout, with[description]). The ranks are listed after the lore, and action tooltips are appended.NEXT/PREVIOUS— paging.protection.flags.COMMAND_RANKS.name,protection.panel.next/previousand the existingflag-itemlayouts.Code
CommandRanksPanel(panels/customizable), aPanelListenerrefreshed after every click likeSettingsPanel, with the click cooldown on.CommandRankClickListeneropens it through the game mode's player command, whichAbstractPanelneeds for the plugin and the addon's template folder. It falls back to the oldPanelBuilderlayout, still capped at 49, when there is no player command or the template can't be loaded.@since 3.23.3):CommandRankClickListener.getCommands(World, User)andgetPanelItemBuilder(String, User, World, Island, ItemTemplateRecord). The existinggetPanelItem(String, User, World)is unchanged and delegates to the new builder.CommandCycleClick. Left and right cycle the rank, and shift-left lets an op hide a command.Tests
CommandRanksPanelTest: default layout, paging across 50 commands, missing template, game mode template overriding title, icon and name layout.CommandRankClickListenerTest: clicking the flag opens the templated panel when the game mode has a player command.Not tested in-game yet.
🤖 Generated with Claude Code