feat(v2): builder snippet export + ConversationFactory prompts - #1
feat(v2): builder snippet export + ConversationFactory prompts#1Pinont wants to merge 13 commits into
Conversation
- DevToolCommand extends lib CommandGroup: /devtool [plugin] | help - /devtool opens DevToolMenu; /devtool <plugin> opens PluginPanelMenu (auto-discovered via PluginRegistry); unknown plugin → error/help - PluginPanelMenu: PaginatedMenu showing plugin name/version/class/status, component slots reserved for the lib component registry - DevTool.java now uses explicit registerComponents() DSL (no @AutoRegister scan) - old monolithic commands/DevTool.java removed (superseded)
- /devtool itemstudio: PaginatedMenu over every item material; picking one gives a creator-built item with Attributes applied (try-create) - /devtool recipe <key>: registers a furnace recipe via RecipeRegistry - demonstrates lib PaginatedMenu + Attributes + RecipeRegistry integration
- DevToolCommandTest (5 tests): exercises DevToolCommand through the
CommandGroup sender-based execute(CommandSender, String[]) path:
root menu for a player (asserts a 45-slot inventory opens), help
for console, unknown-plugin failure path, and the known-plugin
console + player panel paths (both via PluginRegistry lookup).
- DevToolRegistrationTest (3 tests): verifies CorePlugin lifecycle
registration into PluginRegistry (count > 0, get("SingularityDevTool")
!= null), the explicit onPluginStart registerComponents wiring that
publishes the devtool:dt command, and isEnabled().
- fix(menu): DevToolMenu item builders passed legacy ChatColor strings
to ItemCreator.setName/addLore(String), which deserialize via
MiniMessage and throw ParsingException on legacy '§' codes. The
player /devtool menu crashed for everyone. Replaced with the
Component-based overloads (colors preserved via NamedTextColor).
- docs: AGENTS.md known-issues no longer claims "no tests at all".
…l config) Step 4 of the plan — the flagship DevTool feature: - ConfigEditorMenu: PaginatedMenu over config.yml keys; booleans toggle on click, numbers step ±1 (sneak reverses), strings prompt in chat - ChatPrompt: scoped one-shot per-player chat input (replaces old global ChatEvent hack); 'cancel' aborts; re-opens editor after capture - Save & Reload button persists via CommentConfigManager.save() and triggers CorePlugin.reloadReloadables(); Revert closes - /devtool config <plugin> subcommand wired - 11 tests green
Step 5 — inspect held item vanilla NBT via lib NmsBridge; --entity flag targets the looked-at entity; graceful message when SingularityNMS missing. 11 tests green.
Replace the global ChatEvent/SendChat/ChatPrompt chat-steal with per-player Paper ConversationFactory prompts (world name/border/seed and config strings). Item Studio and Entity Studio now export ready-to-paste ItemCreator/CustomItem and spawn snippets via click-to-copy plus a written book fallback. Co-authored-by: Nonnipat Tangrojjanakhajorn <contact@pinont.me>
JUnit 5 tests were silently skipped under the default Surefire 2.12.4. Item Studio now ignores materials whose isItem() lookup is unimplemented in MockBukkit so /devtool itemstudio can be exercised without clicks. Co-authored-by: Nonnipat Tangrojjanakhajorn <contact@pinont.me>
There was a problem hiding this comment.
🟡 Changes recommended
There are verified correctness/documentation issues in newly added functionality (conversation modality allowing prompt input to flow into normal chat, null-handling bug in config editor rendering, and inspect --entity behavior/description mismatch).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR advances the DevTool v2 roadmap by adding in-game Java snippet export (item/entity builders + held-item export) and migrating chat prompts to Paper conversations, while also introducing a MockBukkit-based test suite and build updates to support reliable CI.
Changes:
- Added snippet generation/delivery utilities (click-to-copy + book fallback) and new Item Studio / Entity Studio result flows.
- Replaced the global chat-listener prompt hack with per-player
ConversationFactoryprompts for world creation and config string editing. - Added MockBukkit/JUnit coverage plus Maven/CI tweaks to ensure tests run in automation.
File summaries
| File | Description |
|---|---|
| src/test/java/com/github/pinont/devtool/methods/StartConversationTest.java | Adds tests for starting conversations and snippet pagination. |
| src/test/java/com/github/pinont/devtool/methods/ItemSnippetTest.java | Adds string-based tests for item snippet generation. |
| src/test/java/com/github/pinont/devtool/methods/EntitySnippetTest.java | Adds tests for entity spawn snippet generation. |
| src/test/java/com/github/pinont/devtool/DevToolTest.java | Adds basic plugin load smoke tests under MockBukkit. |
| src/test/java/com/github/pinont/devtool/DevToolRegistrationTest.java | Verifies registry + component publication behavior for v2 lifecycle wiring. |
| src/test/java/com/github/pinont/devtool/commands/DevToolCommandTest.java | Covers command-group dispatch paths without inventory click simulation. |
| src/main/java/com/github/pinont/devtool/tools/NbtInspector.java | Introduces an NBT inspector command surface (item implemented; entity path currently stubbed). |
| src/main/java/com/github/pinont/devtool/methods/WorldCreatorContent.java | Removes legacy world-creator chat state interface (old prompt hack). |
| src/main/java/com/github/pinont/devtool/methods/StartConversation.java | Adds conversation helper to replace global chat interception. |
| src/main/java/com/github/pinont/devtool/methods/SendChat.java | Removes legacy chat-event handler for world creator input. |
| src/main/java/com/github/pinont/devtool/methods/PromptWorldInput.java | Adds world-creator prompt wrappers using conversations. |
| src/main/java/com/github/pinont/devtool/methods/ItemSnippet.java | Adds Java snippet generation for studio items and arbitrary held items. |
| src/main/java/com/github/pinont/devtool/methods/GetWorldCreatorMenu.java | Switches world-creator buttons from metadata+chat hack to conversation prompts. |
| src/main/java/com/github/pinont/devtool/methods/ExportSnippet.java | Adds click-to-copy + chat preview + written-book snippet delivery. |
| src/main/java/com/github/pinont/devtool/methods/EntitySnippet.java | Adds entity spawn snippet generation. |
| src/main/java/com/github/pinont/devtool/menu/submenu/PluginPanelMenu.java | Adds a v2 plugin panel menu backed by PaginatedMenu. |
| src/main/java/com/github/pinont/devtool/menu/submenu/OtherToolsMenu.java | Expands tools menu to launch studios and held-item export. |
| src/main/java/com/github/pinont/devtool/menu/submenu/ItemStudioResultMenu.java | Adds result screen actions: grant built item + export snippets. |
| src/main/java/com/github/pinont/devtool/menu/submenu/ItemStudioMenu.java | Adds paginated material picker and studio item creation flow. |
| src/main/java/com/github/pinont/devtool/menu/submenu/EntityStudioResultMenu.java | Adds entity result screen with spawn snippet export action. |
| src/main/java/com/github/pinont/devtool/menu/submenu/EntityStudioMenu.java | Adds paginated entity picker and navigation to result screen. |
| src/main/java/com/github/pinont/devtool/menu/submenu/ConfigEditorMenu.java | Adds live config editor with conversation-backed string editing. |
| src/main/java/com/github/pinont/devtool/menu/DevToolMenu.java | Migrates menu item text to Adventure components (avoids legacy ChatColor in MiniMessage paths). |
| src/main/java/com/github/pinont/devtool/events/ChatEvent.java | Removes global chat listener used by the legacy prompt system. |
| src/main/java/com/github/pinont/devtool/DevTool.java | Adds explicit v2 component registration for commands (no classpath scanning). |
| src/main/java/com/github/pinont/devtool/commands/DevToolCommand.java | Introduces v2 root command group with subcommands (studios/snippet/config/inspect). |
| src/main/java/com/github/pinont/devtool/commands/DevTool.java | Removes legacy brigadier-based SimpleCommand implementation. |
| README.md | Updates documentation for requirements/bootstrap model and v2 roadmap notes. |
| pom.xml | Adds Surefire + MockBukkit/slf4j test deps; removes legacy repo note; supports running JUnit 5 tests. |
| AGENTS.md | Updates repo guidance to reflect conversation prompts and test coverage. |
| .github/workflows/build.yml | Forces Maven snapshot refresh in CI (-U). |
Review details
- Files reviewed: 31/31 changed files
- Comments generated: 7
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| String type = v instanceof Boolean ? "boolean" | ||
| : v instanceof Number ? "number" | ||
| : v instanceof String ? "string" | ||
| : v.getClass().getSimpleName(); |
| ConversationFactory factory = new ConversationFactory(plugin) | ||
| .withModality(false) | ||
| .withLocalEcho(true) | ||
| .withTimeout(60) | ||
| .withEscapeSequence(ESCAPE) |
| } | ||
| // Entity NBT read via the NMS NbtCompound wrapper (entity.save path) — | ||
| // best-effort through the bridge's raw read; extended in step 6. | ||
| player.sendMessage(Component.text("(entity NBT dump coming via NMS Entities facade)", NamedTextColor.GRAY)); |
| <dependency> | ||
| <groupId>io.github.pinont</groupId> | ||
| <artifactId>singularitylib</artifactId> | ||
| <version>2.0.0</version> |
| @Override | ||
| public String getDescription() { | ||
| return "Inspect vanilla NBT (held item or --entity target)"; | ||
| } |
| * <p>Renders every key as a paginated button: | ||
| * <ul> | ||
| * <li><b>Boolean</b> → click toggles the value;</li> | ||
| * <li><b>Number</b> → left-click +1, right-click −1 (stepless ± by shift);</li> |
| /** | ||
| * Prints the targeted entity's NBT (best-effort; entity tags via CraftEntity). | ||
| */ |
…apshot maven.pinont.me still serves the Central 2.0.0 line, which lacks PaginatedMenu, CommandGroup, and Attributes. Checkout Pinont/SingularityLib@main, install the processor + lib locally, then package with -nsu so Maven does not overwrite that snapshot from the remote registry. Co-authored-by: Nonnipat Tangrojjanakhajorn <contact@pinont.me>
Stop fetching the stale maven.pinont.me SNAPSHOT. pom repository id github-pinont now points at maven.pkg.github.com/Pinont/SingularityLib. CI finishes the settings.xml path (setup-java server-id + mvn -s) and authenticates with GITHUB_TOKEN. No lib checkout, no publish workflow. Co-authored-by: Nonnipat Tangrojjanakhajorn <contact@pinont.me>
Two v2 roadmap items on top of the already-landed Item Studio / config editor / NBT inspect work (that work currently lives on
mainbut notrework/v2, so this PR also fast-forwards those commits ontorework/v2rather than rebuilding 1–5).6 — Builder export-snippets
From Item Studio and Entity Studio, export a ready-to-paste Java snippet that reconstructs what was built with SingularityLib APIs (
ItemCreator,CustomItem,Attributes,CorePlugin.getInstance()).Delivery:
ClickEvent.copyToClipboard)7 — Conversations (ChatEvent hack is gone)
World-name / border / seed input and config-editor string keys now use Paper
ConversationFactory(StartConversation+PromptWorldInput). Deleted:events/ChatEvent.javamethods/SendChat.javamenu/submenu/ChatPrompt.javamethods/WorldCreatorContent.java(metadata bag used only by the old hack)Type
cancelto abort a prompt. No global chat listener.QA — export a snippet
/devtool itemstudio(or DevTool → Tools → Item Studio)[Click to copy snippet]in chat, and/or open the written book you were given.new ItemCreator(CorePlugin.getInstance(), Material.…)(andextends CustomItemfor the class export)./devtool snippet, or Tools → Export held item. Entity path:/devtool entitystudio→ pick a type → Export spawn snippet.QA — formerly-ChatEvent prompt
DevTool » Please send a world name….qa_world). The World Creator reopens with that name. Other chat should not be stolen when you are not in a prompt.cancelto abort and reopen./devtool config SingularityDevTool→ click a string key → type a new value (orcancel). Menu reopens with the staged value.Tests
mvn -q test(Surefire 3.5.2 so JUnit 5 actually runs). Coverage includes snippet generation (ItemSnippet/EntitySnippet) andStartConversation.ask()beginning a conversation and deliveringacceptConversationInput, plus/devtool itemstudio|entitystudio|snippetwithout inventory-click simulation.CI / lock — GitHub Packages (green on
b14d4af)Consumer resolution no longer uses
https://maven.pinont.me/. There is no SingularityLib source checkout and no new publish workflow.pom.xml<repositories>—id: github-pinont→https://maven.pkg.github.com/Pinont/SingularityLib(snapshotsupdatePolicy: always). Artifact remainsio.github.pinont:singularitylib:2.0.0-SNAPSHOT(provided; not shaded). Processor not required for this consumer..github/workflows/build.yml—packages: read;setup-javaserver-id: github-pinont+settings-path: ${{ github.workspace }};mvn -B -U clean package -s ${{ github.workspace }}/settings.xmlwithGITHUB_TOKEN: ${{ github.token }}.Lock evidence (run 33594284810): BUILD SUCCESS, 24 tests / 0 failures. Maven downloaded
singularitylib-2.0.0-20260902.051046-23(122 kB) fromgithub-pinont/ Packages. Zero hits onmaven.pinont.me.