Skip to content

Add Dialogs API and wire it into confirmations, go picker, team invites & first-join (#3021)#3033

Open
tastybento wants to merge 2 commits into
developfrom
feature/3021-dialogs-api
Open

Add Dialogs API and wire it into confirmations, go picker, team invites & first-join (#3021)#3033
tastybento wants to merge 2 commits into
developfrom
feature/3021-dialogs-api

Conversation

@tastybento

@tastybento tastybento commented Jul 11, 2026

Copy link
Copy Markdown
Member

Closes #3021.

What

Introduces a public api/dialogs/ package wrapping Paper's modal dialog system (io.papermc.paper.dialog.Dialog, Minecraft 26+) alongside the Panels API, and wires it into all four high-friction flows from the issue. Dialogs are real modal UI — the "menu players can't click away".

API surface (world.bentobox.bentobox.api.dialogs)

Type Purpose
DialogButton Label + optional tooltip + an onClick Consumer<User>, run on the main thread when clicked.
DialogBuilder Fluent: title/body (localized via User), escapable, pause, plus confirmation(yes, no) and multi-action button(...). build()BBDialog.
BBDialog Built dialog; show(User).
Dialogs isSupported() guard for graceful degradation.

Everything is Adventure Component-based end-to-end so click data survives (the legacy §-string path cannot carry it).

Consumers

All are gated by a new consolidated island.dialogs.* config section, and every one falls back to the prior behaviour if the dialog can't be built/shown (older server, error):

  1. Confirmations (island.dialogs.confirmations, default true) — ConfirmableCommand.askConfirmation shows [Confirm]/[Cancel] instead of asking the player to re-type the command.
  2. Go picker (island.dialogs.go-picker, default true) — a bare /island go with more than one island/home opens a button-per-destination picker; each button teleports there.
  3. Team invites (island.dialogs.team-invites, default true) — receiving an invite auto-opens an [Accept]/[Decline] dialog that runs the accept/reject command.
  4. First-join game-mode selection (island.dialogs.game-mode-selection, default false) — a non-dismissable "choose your game" dialog for brand new players when several game modes are installed; each button runs that mode's command. Off by default because it is intrusive/non-dismissable.

Locales

All new en-US keys translated into every other locale (22 files) preserving each file's MiniMessage style.

Tests

DialogBuilderTest (support detection, button holders, validation) plus fallback/gating tests in IslandResetCommandTest, IslandGoCommandTest, IslandTeamInviteCommandTest and JoinLeaveListenerTest. Full ./gradlew build green.

MockBukkit limitation: building a complete dialog needs the server's dialog registry provider (DialogInstancesProvider), which MockBukkit does not supply — like NMS. So actual dialog display is verified on a live server; unit tests cover support detection, validation and the graceful fallbacks.

Open questions for reviewers

  • Public API stability — binary-compat-committed surface; worth a look at the builder/type shape before release.
  • Bedrock/Geyser — do dialogs render as Bedrock forms, or is a Panels fallback needed? Needs live testing.
  • Defaults — confirmations/go-picker/team-invites default on; game-mode-selection deliberately off.

🤖 Generated with Claude Code

tastybento and others added 2 commits July 11, 2026 16:44
Introduces a public api/dialogs/ package that wraps Paper's modal dialog
system (io.papermc.paper.dialog.Dialog, present on Minecraft 26+) alongside
the existing Panels API, so core and addons can present real modal choices
without the player typing commands.

- DialogButton: label + optional tooltip + an onClick Consumer<User> run on
  the main thread when clicked.
- DialogBuilder: fluent builder (title/body localized via User, escapable,
  pause) supporting confirmation(yes, no) and multi-action button() menus;
  build() -> BBDialog with show(User). Everything is carried as Adventure
  Components end-to-end so click/interaction data survives.
- Dialogs.isSupported(): guard for graceful degradation on older servers.

First consumer: ConfirmableCommand.askConfirmation now shows a
[Confirm]/[Cancel] dialog instead of asking the player to re-type the
command. Enabled by default via the new island.confirmation.use-dialog
setting (opt out to keep the type-again prompt). If the dialog cannot be
built or shown for any reason, it falls back to the classic prompt so a
confirmation is never silently lost.

New en-US locale keys (commands.confirmation.title, .dialog-body,
.buttons.confirm, .buttons.cancel) translated into all 22 other locales.

Note: DialogBuilder.build() of a full dialog needs the server's dialog
registry provider, which MockBukkit does not supply (like NMS), so those
paths run on a live server; unit tests cover support detection, button
holders, pre-factory validation and the confirmation fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7UmQDCP5MGHEZqFiw44zH
Adds the remaining three Dialogs API consumers and consolidates every dialog
toggle under one island.dialogs.* config section (the confirmation toggle
moves from island.confirmation.use-dialog to island.dialogs.confirmations;
still pre-release, so no compatibility break).

- go picker: a bare /island go with more than one island/home now opens a
  button-per-destination dialog; each button teleports there. Gated by
  island.dialogs.go-picker (default true).
- team invites: receiving an invite auto-opens an [Accept]/[Decline] dialog
  that runs the accept/reject command, instead of relying on the player to
  type it. Gated by island.dialogs.team-invites (default true).
- first join: brand new players can be shown a non-dismissable "choose your
  game" dialog when several game modes are installed; each button runs that
  game mode's command. Gated by island.dialogs.game-mode-selection
  (default FALSE - it is intrusive and non-dismissable).

Every consumer degrades gracefully: if the dialog cannot be built/shown it
logs and falls back to the previous behaviour (teleport / chat invite /
per-world first-login), so nothing is lost on older servers or under errors.

New en-US keys (commands.island.go.picker.title, the
commands.island.team.invite.dialog.* group, and
general.dialogs.game-mode-selection.title) translated into all 22 other
locales. Fallback/gating paths covered by tests in IslandGoCommandTest,
IslandTeamInviteCommandTest and JoinLeaveListenerTest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7UmQDCP5MGHEZqFiw44zH
@tastybento tastybento changed the title Add Dialogs API and use it for command confirmations (#3021) Add Dialogs API and wire it into confirmations, go picker, team invites & first-join (#3021) Jul 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

Design: Dialogs API — modal dialogs alongside Panels for high-friction player flows

1 participant