Add Dialogs API and wire it into confirmations, go picker, team invites & first-join (#3021)#3033
Open
tastybento wants to merge 2 commits into
Open
Add Dialogs API and wire it into confirmations, go picker, team invites & first-join (#3021)#3033tastybento wants to merge 2 commits into
tastybento wants to merge 2 commits into
Conversation
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
|
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 #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)DialogButtononClickConsumer<User>, run on the main thread when clicked.DialogBuildertitle/body(localized viaUser),escapable,pause, plusconfirmation(yes, no)and multi-actionbutton(...).build()→BBDialog.BBDialogshow(User).DialogsisSupported()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):island.dialogs.confirmations, default true) —ConfirmableCommand.askConfirmationshows[Confirm]/[Cancel]instead of asking the player to re-type the command.island.dialogs.go-picker, default true) — a bare/island gowith more than one island/home opens a button-per-destination picker; each button teleports there.island.dialogs.team-invites, default true) — receiving an invite auto-opens an[Accept]/[Decline]dialog that runs the accept/reject command.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-USkeys translated into every other locale (22 files) preserving each file's MiniMessage style.Tests
DialogBuilderTest(support detection, button holders, validation) plus fallback/gating tests inIslandResetCommandTest,IslandGoCommandTest,IslandTeamInviteCommandTestandJoinLeaveListenerTest. Full./gradlew buildgreen.Open questions for reviewers
🤖 Generated with Claude Code