Skip to content

feat(v2): builder snippet export + ConversationFactory prompts - #1

Open
Pinont wants to merge 13 commits into
rework/v2from
cursor/builder-snippets-conversations-8b5e
Open

feat(v2): builder snippet export + ConversationFactory prompts#1
Pinont wants to merge 13 commits into
rework/v2from
cursor/builder-snippets-conversations-8b5e

Conversation

@Pinont

@Pinont Pinont commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Two v2 roadmap items on top of the already-landed Item Studio / config editor / NBT inspect work (that work currently lives on main but not rework/v2, so this PR also fast-forwards those commits onto rework/v2 rather 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:

  • Adventure click-to-copy chat line (ClickEvent.copyToClipboard)
  • Chat preview of the first lines
  • Written book with the full snippet if the clipboard payload is large or copy is inconvenient

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.java
  • methods/SendChat.java
  • menu/submenu/ChatPrompt.java
  • methods/WorldCreatorContent.java (metadata bag used only by the old hack)

Type cancel to abort a prompt. No global chat listener.

QA — export a snippet

  1. /devtool itemstudio (or DevTool → Tools → Item Studio)
  2. Pick a material (e.g. diamond sword). You get the studio item and a Studio Result menu.
  3. Click Export ItemCreator or Export CustomItem.
  4. Click [Click to copy snippet] in chat, and/or open the written book you were given.
  5. Confirm the Java uses new ItemCreator(CorePlugin.getInstance(), Material.…) (and extends CustomItem for the class export).
  6. Extra paths: hold an item → /devtool snippet, or Tools → Export held item. Entity path: /devtool entitystudio → pick a type → Export spawn snippet.

QA — formerly-ChatEvent prompt

  1. DevTool → Worlds → World Creator → Set World Name. Inventory closes; chat shows DevTool » Please send a world name….
  2. Type a name (e.g. qa_world). The World Creator reopens with that name. Other chat should not be stolen when you are not in a prompt.
  3. Same flow for World Border Size (must be a positive int) and Seed (must be a long). Type cancel to abort and reopen.
  4. Config editor: /devtool config SingularityDevTool → click a string key → type a new value (or cancel). 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) and StartConversation.ask() beginning a conversation and delivering acceptConversationInput, plus /devtool itemstudio|entitystudio|snippet without 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-pinonthttps://maven.pkg.github.com/Pinont/SingularityLib (snapshots updatePolicy: always). Artifact remains io.github.pinont:singularitylib:2.0.0-SNAPSHOT (provided; not shaded). Processor not required for this consumer.

.github/workflows/build.ymlpackages: read; setup-java server-id: github-pinont + settings-path: ${{ github.workspace }}; mvn -B -U clean package -s ${{ github.workspace }}/settings.xml with GITHUB_TOKEN: ${{ github.token }}.

Lock evidence (run 33594284810): BUILD SUCCESS, 24 tests / 0 failures. Maven downloaded singularitylib-2.0.0-20260902.051046-23 (122 kB) from github-pinont / Packages. Zero hits on maven.pinont.me.

Open in Web Open in Cursor 

Pinont and others added 11 commits August 28, 2026 17:52
- 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>
@Pinont
Pinont marked this pull request as ready for review September 1, 2026 20:09
Copilot AI lite review requested due to automatic review settings September 1, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 ConversationFactory prompts 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.

Comment on lines +102 to +105
String type = v instanceof Boolean ? "boolean"
: v instanceof Number ? "number"
: v instanceof String ? "string"
: v.getClass().getSimpleName();
Comment on lines +45 to +49
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));
Comment thread README.md
<dependency>
<groupId>io.github.pinont</groupId>
<artifactId>singularitylib</artifactId>
<version>2.0.0</version>
Comment on lines +222 to +225
@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>
Comment on lines +51 to +53
/**
* Prints the targeted entity's NBT (best-effort; entity tags via CraftEntity).
*/
cursoragent and others added 2 commits September 1, 2026 20:16
…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>
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.

3 participants