Skip to content

Add a prompts API to replace Bukkit conversations - #3140

Merged
tastybento merged 3 commits into
developfrom
feat/prompt-api
Nov 23, 2026
Merged

tastybento merged 3 commits into
developfrom
feat/prompt-api

Conversation

@tastybento

@tastybento tastybento commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Why

Paper has marked org.bukkit.conversations as @Deprecated(forRemoval = true) (checked in the 26.3 API jar). Core uses it in 14 files, and eight addons use it through near-identical copies of ConversationUtils / ChatInput.

What

A new public package, world.bentobox.bentobox.api.prompts, that asks a player to type something:

Call Gives
Prompts.text(user) one line of text
Prompts.id(user) one line, sanitized for use as a unique id
Prompts.lines(user) several lines (List<String>)
Prompts.integer(user, min, max) / Prompts.decimal(user, min, max) a number in a range
Prompts.confirm(user) a yes/no confirmation
Prompts.text(user)
    .title("myaddon.rename.title")
    .initial(thing.getName())
    .maxLength(32)
    .validate(name -> taken(name) ? user.getTranslation("myaddon.rename.taken") : null)
    .onSubmit(thing::setName)
    .onCancel(() -> panel.open())
    .open();
  • Dialog first. Where dialogs are supported and the new island.dialogs.prompts setting is on (default), the prompt is a dialog with a text box, pre-filled with the current value. A bad answer re-opens the dialog with the reason and what was typed.
  • Chat fallback. Otherwise (Minecraft 1.21.5, the setting off, or a dialog that fails to build) the question is asked in chat through a core-owned AsyncChatEvent listener. It has a cancel word, a done word for multi-line input and a 90 second timeout. It does not use the Bukkit conversation API.
  • Callbacks run on the main thread, and onSubmit only receives a value that passed parsing and every validate check.

Core call sites converted

  • /island renamehome
  • team invite panel search
  • settings panel "reset to default" confirmation (both SettingsPanel and SettingsTab)
  • blueprint management: bundle name, blueprint name, description, commands
  • PickerPanel search, which was hidden where dialogs are unsupported and now works there in chat

Behaviour changes to know about

  • Blueprint description and commands are now edited in place in a multi-line box, starting from the current text, instead of being retyped line by line.
  • In the chat fallback for description/commands, finishing with no lines now clears the value; before it cancelled. The old clear word is gone.
  • A bundle can be renamed to a name that produces its own id (for example to change only its colours); before that was refused as "not unique".
  • Cancelling a blueprint or invite prompt reopens the panel it came from.
  • The invite search prompt starts from the current search text, and submitting it empty clears the search. Before, a search could not be cleared.
  • The reset confirmation in a dialog is two buttons; in chat the confirm word comes from the new prompts.chat.confirm-word, and protection.panel.reset-to-default.confirm / .instructions are no longer used.
  • Pressing Escape on a dialog does not run onCancel, because the server is not told about it.

Compatibility

Nothing is removed. The nine old conversation classes and the four Conversable overloads on BlueprintManagementPanel are kept and marked @Deprecated(since = "3.25.0", forRemoval = true); no addon checked out locally uses them. They will have to be deleted when Paper actually removes the API.

Locale and config

  • ⚙️ island.dialogs.prompts (default true).
  • 🔡 16 new keys (prompts.* and four under commands.admin.blueprint.management), translated into all 23 other locales.

Testing

  • 47 new tests: PromptsTest (28), IslandRenamehomeCommandTest (5, new), plus additions to BlueprintManagementPanelTest, SettingsPanelTest and IslandTeamInviteGUITest. Full suite: 3,864+ pass.
  • Tested in game on Paper 26.3 by tastybento, with a Java client:
    • dialog path: rename home (including the "already exists" and empty-answer re-prompts), invite search, settings reset, bundle name, description with colour codes, commands, Escape;
    • chat fallback (island.dialogs.prompts: false): single-line, multi-line with done/cancel, confirmation, the 90 second timeout, and commands still working while a prompt waits.
  • Tested in game on Paper 1.21.5 by tastybento, where there are no dialogs and the chat fallback is the only path.
  • Not tested with a Bedrock client; how Geyser shows a dialog with a text box is unverified.

Follow-up

Each addon's ConversationUtils can keep its method signatures and delegate to Prompts, once it requires BentoBox 3.25.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HBXcjai4FihmV4n54fjjMe

tastybento and others added 3 commits November 22, 2026 16:21
Paper has deprecated org.bukkit.conversations for removal. Core used it in
14 files and eight addons use it through copies of ConversationUtils.

New package api.prompts asks a player for text, an id, several lines, a
number or a confirmation. A prompt is shown as a dialog with a text box
where dialogs are supported and island.dialogs.prompts is on, and is asked
in chat otherwise, through a core-owned AsyncChatEvent listener. Answers
are validated and asked for again when wrong.

Core's own prompts now use it: home renaming, the team invite search, the
settings reset confirmation, the blueprint bundle name, description and
commands, and the picker search, which now also works without dialogs. The
old conversation classes and the Conversable overloads on
BlueprintManagementPanel stay, deprecated for removal.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HBXcjai4FihmV4n54fjjMe
Split the starting name and the length check out of askName, drop the
nested ternary, and use the MANAGEMENT constant throughout.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HBXcjai4FihmV4n54fjjMe
The search prompt now starts from the current search text, and submitting
it empty clears the search instead of being refused.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HBXcjai4FihmV4n54fjjMe
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 43994cc into develop Nov 23, 2026
3 checks passed
tastybento added a commit to BentoBoxWorld/Biomes that referenced this pull request Nov 23, 2026
…185)

## Why

Paper has marked `org.bukkit.conversations` as deprecated for removal.
This addon used it, through `ConversationUtils`, every time it asked a
player to type something.

## What

`ConversationUtils` keeps its method signatures, so no panel code
changes, and now hands the work to the prompts API added in BentoBox
3.25.0
([BentoBox#3140](BentoBoxWorld/BentoBox#3140)).
The player gets a dialog with a text box where the server supports
dialogs, and is asked in chat otherwise.

Callers get the same answers as before: the value on success, and `null`
(or `false` for a confirmation) when the player cancels or does not
answer.

## Behaviour changes

- Input is asked for in a dialog by default. Server admins can set
`island.dialogs.prompts: false` in BentoBox's config to keep everything
in chat.
- Error messages for a bad number, and the cancel / done / confirm words
in chat, now come from BentoBox's locale (`prompts.*`). This addon's own
`conversations.confirm-string`, `deny-string`, `exit-string`,
`cancel-string`, `numeric-only`, `not-valid-value` and `prefix` keys are
no longer used.
- A confirmation in chat is confirmed only by BentoBox's confirm word;
anything else declines.
- Pressing Escape on a dialog closes it without reopening the panel it
came from.
- Some question texts still say "in chat" or "write 'cancel' to exit",
which reads oddly in a dialog. The wording is unchanged in this PR.

- `createIDStringInput` still hands the consumer the text exactly as
typed (callers sanitize it), and a refused ID still shows the caller's
failure message with the sanitized `[id]`.
- Multi-line input now translates colour codes with BentoBox's
`Util.translateColorCodes` (which also understands hex codes) instead of
`ChatColor.translateAlternateColorCodes`.

## Toolchain upgrade

BentoBox 3.25 is built for Java 25, so this addon could not stay on Java
21 / Paper 1.21.11 / BentoBox 3.14.0:

- Java 21 → 25, Paper API 1.21.11 → 26.3.build.231-stable, BentoBox
3.14.0 → 3.25.0-SNAPSHOT.
- MockBukkit `com.github.MockBukkit:MockBukkit:v1.21-SNAPSHOT` →
`org.mockbukkit.mockbukkit:mockbukkit-v26.3:4.119.0`; Mockito 5.11.0 →
5.20.0.
- maven-shade-plugin 3.6.0 → 3.6.2 and JaCoCo 0.8.10 → 0.8.15, because
the old versions cannot read Java 25 class files.
- Added the BentoBox snapshot repository (`repo.codemc.io`).
- Workflows: `build.yml` used JDK 17 with `setup-java@v1`, now JDK 25
(Temurin) with `setup-java@v4`; `modrinth-publish.yml` JDK 21 → 25.
- `addon.yml` `api-version` 1.20 → 3.25.0.

No source changes were needed for the newer APIs. The build still
reports existing deprecation-for-removal warnings (`Biome.values()`,
`OldEnum.name()`, `PotionData`, `Registry.match`,
`BentoBox.getRanksManager()`); they are not addressed here.

## Requires BentoBox 3.25.0

`bentobox.version` is `3.25.0-SNAPSHOT` because 3.25.0 is not released
yet. **Change it to `3.25.0` before releasing this addon.**

## Testing

- New `ConversationUtilsTest` (10 tests) covers each method on the chat
path, including cancel and a refused ID. `mvn verify`: 92 tests pass.
- Not tested in game. The dialog path cannot be unit tested; the
underlying prompts were tested in game for BentoBox#3140.
- The publish workflows' game-version lists were not changed.

## Version

2.3.3 → 2.4.0. The last release is 2.3.2; a new minimum BentoBox, Java
and Minecraft is more than a patch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01HBXcjai4FihmV4n54fjjMe
@tastybento
tastybento deleted the feat/prompt-api branch November 24, 2026 01:18
@tastybento tastybento mentioned this pull request Nov 24, 2026
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