Skip to content

Add placeholder browser GUI and dump command (#1332)#2803

Merged
tastybento merged 4 commits intodevelopfrom
feature/placeholder-gui-1332
Feb 22, 2026
Merged

Add placeholder browser GUI and dump command (#1332)#2803
tastybento merged 4 commits intodevelopfrom
feature/placeholder-gui-1332

Conversation

@tastybento
Copy link
Member

@tastybento tastybento commented Feb 22, 2026

Summary

Implements #1332.

  • /bbox placeholders (alias ph) — player-only command that opens a hierarchical GUI showing all registered placeholders grouped by source (one button per addon). Clicking an addon opens a drill-down tree navigator that splits keys on _ and applies path compression to avoid empty intermediate folders. Layout is customisable via BentoBox/panels/placeholder_panel.yml and placeholder_list_panel.yml.
  • /bbox dump-placeholders — console/admin command that writes plugins/BentoBox/placeholder-dump.md, a Markdown table of every placeholder and its plain-English description, suitable for the BentoBoxWorld/docs site. Numeric series are collapsed (e.g. 50 island_member_name_N rows → one row with range annotation).

Data-layer changes

  • BasicPlaceholderExpansion stores a description alongside each replacer and tracks a disabled-placeholder set for in-memory toggle (state resets on restart).
  • PlaceholderHook / PlaceholderAPIHook gain description-aware overloads, enable/disable API, and introspection methods (getRegisteredPlaceholders, getAddonsWithPlaceholders, getDescription). Also fixes a bug where only the first placeholder per addon expansion was tracked.
  • PlaceholdersManager exposes the same API publicly.
  • GameModePlaceholder constants now carry a plain-English description string shown in the GUI and dump.

Scalability (handles addons with thousands of placeholders)

  • PlaceholderGrouper collapses numeric-suffix series (island_member_name_1..50 → one Series item).
  • PlaceholderNode builds a _-split trie with path compression (single-child FOLDER chains are merged) for efficient tree navigation.
  • PlaceholderListPanel uses the trie for drill-down with five node types — LEAF / FOLDER / LEAF_FOLDER / SERIES / LEAF_SERIES — each with distinct icons (PAPER / CHEST / BOOK / NAME_TAG / WRITABLE_BOOK) and left/right-click semantics.

GUI details

  • Panel title shows the current node label only (not the full breadcrumb path) to stay within Minecraft's title width limit; colour is &3 (dark aqua) for readability against the grey inventory background.
  • Long placeholder descriptions are word-wrapped at 38 characters per lore line.
  • Each placeholder item shows its current resolved value for the viewing player (→ <value> or → (empty)). Series items show up to 3 sample values (#1 → …, #2 → …, #3 → …).
  • The BentoBox core source button is hidden when no core placeholders are registered (currently always the case — all placeholders live under addon expansions).
  • Clicking a placeholder or series toggles it enabled/disabled in-memory (disabled placeholders return "" instead of their resolved value).

Test plan

  • All existing tests pass (./gradlew test)
  • 18 new tests for PlaceholderGrouper (grouping, series detection, description stripping, sorting)
  • 19 new tests for PlaceholderNode (trie construction, all 5 node types, path compression, counting, drill-in navigation)
  • /bbox placeholders opens the browser GUI in-game; addon buttons show correct icons and counts
  • Clicking an addon opens the per-source tree; clicking a FOLDER drills in; BACK navigates up; breadcrumb in title updates
  • LEAF: click toggles (glows when disabled); value shown in lore
  • SERIES: click toggles all members; up to 3 sample values shown
  • LEAF_FOLDER: left-click toggles leaf, right-click drills in
  • LEAF_SERIES: left-click toggles leaf, right-click toggles all series members
  • /bbox dump-placeholders writes placeholder-dump.md with collapsed series rows and range annotations
  • Panel YML files can be customised by editing files in BentoBox/panels/

🤖 Generated with Claude Code

tastybento and others added 4 commits February 21, 2026 16:40
- `/bbox placeholders` (alias `ph`) opens a hierarchical GUI showing all
  registered placeholders grouped by source (BentoBox core + each addon).
  The panel layout is customisable via `BentoBox/panels/placeholder_panel.yml`
  and `placeholder_list_panel.yml`.

- `/bbox dump-placeholders` writes `plugins/BentoBox/placeholder-dump.md`,
  a Markdown table of every placeholder and its plain-English description,
  suitable for the BentoBoxWorld/docs site.

Data-layer changes:
- `BasicPlaceholderExpansion` stores a description alongside each replacer
  and tracks a disabled-placeholder set for in-memory toggle.
- `PlaceholderHook` / `PlaceholderAPIHook` gain description-aware overloads,
  enable/disable API, and introspection methods (getRegisteredPlaceholders,
  getAddonsWithPlaceholders, getDescription).
- `PlaceholdersManager` exposes the same API publicly and fixes a bug where
  only the first placeholder per addon was tracked.
- `GameModePlaceholder` constants now carry a plain-English description string.

Scalability improvements for large placeholder sets:
- `PlaceholderGrouper` collapses numeric-suffix series
  (e.g. island_member_name_1..50) into a single Series item, reducing
  thousands of rows to a handful.
- `PlaceholderNode` builds a `_`-split trie with path compression
  (single-child FOLDER chains are merged) for efficient tree navigation.
- `PlaceholderListPanel` uses the trie for drill-down navigation with
  five node types (LEAF/FOLDER/LEAF_FOLDER/SERIES/LEAF_SERIES), each
  with appropriate icons and left/right-click semantics.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change panel title colour from &6 (gold) to &3 (dark aqua) for
  readability against the grey inventory background.
- Remove the " Placeholders" suffix from the list-panel title and show
  only the current node label (not the full breadcrumb path), keeping
  the title within Minecraft's ~22-char bold-text limit.
- Wrap long placeholder descriptions at 38 characters per line so text
  like "Number of members currently online on the island the player is
  standing on" is split across readable lore lines instead of overflowing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each placeholder item in the list panel now shows the current value
for the viewing player alongside the description:

- LEAF / LEAF_FOLDER: one "→ <value>" line (or "→ (empty)" if blank)
- SERIES / LEAF_SERIES: up to 3 sample lines "#N → <value>" for the
  first N members of the series, so admins can verify the values
  without leaving the GUI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ests

- PlaceholderPanel: hide the BentoBox core placeholder button when no
  core placeholders are registered (currently always 0), avoiding a
  confusing "0 core placeholders" entry in the GUI.

- PlaceholderListPanel: fix LEAF_SERIES button name — series.displayKey()
  already contains "_{N}", so appending it again produced "stem_{N}_{N}".

- Add PlaceholderGrouperTest (18 tests) covering: empty input, plain
  single keys, numeric-suffix series detection, min/max tracking, raw-key
  ordering, stem-also-registered-as-single case, output sorting,
  description lookup, series description stripping, and the
  stripTrailingHashNumber helper.

- Add PlaceholderNodeTest (19 tests) covering: empty trie, single/series
  node construction, all five NodeType values, path compression (stops at
  leaf, series, and multi-child nodes; partial compression for fan-out
  chains), alphabetic sort of display children, totalPlaceholderCount
  (leaf / series / recursive), and drill-into navigation of a compressed
  node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tastybento tastybento merged commit 22c9a81 into develop Feb 22, 2026
2 of 3 checks passed
@tastybento tastybento deleted the feature/placeholder-gui-1332 branch February 22, 2026 02:10
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