Skip to content

Improve /mimic commands UX via Paper Brigadier API - #62

Merged
osipxd merged 3 commits into
developfrom
feature/brigadier-commands
Nov 9, 2026
Merged

osipxd merged 3 commits into
developfrom
feature/brigadier-commands

Conversation

@osipxd

@osipxd osipxd commented Nov 8, 2026

Copy link
Copy Markdown
Member

Replaces CommandAPI with Paper's Brigadier API (Commands, ArgumentTypes, LifecycleEvents.COMMANDS), so the CommandAPI plugin is no longer needed. FallbackCommand, the softDepend, and the catalog entries are removed.

Three commits, reviewable separately:

  • Migration: same commands, arguments and output as before.
  • Fix: the permissions class system counts only explicitly set mimic.class.* permissions. Previously, operators had all classes.
  • UX rework:
    • info is the default for each group, with headers and clickable command hints.
    • Coloured verdicts, command errors for failures, click-to-copy IDs.
    • Key-type item and block arguments with a separate payload; namespace-aware substring suggestions with tooltips.
    • items give uses vanilla order: <target> <item> [amount] [payload].
    • blocks set replaces an occupied block; blocks break and blocks compare default to the targeted block and the held item.
    • xp takes a single value: [+|-]<amount>[L|P|T].
    • /mimic config values are validated.
    • Removed xp has, items id, blocks id, and the experience and inv aliases.

The UX commit changes command syntax; see the CHANGELOG for the full list.

Testing

  • updateKotlinAbi and check -PwarningsAsErrors=true pass on the rebased branch (144 tests).
  • Before the rebase, every subcommand was run on Paper 1.21.5 with a Mineflayer bot, over RCON, and by hand in-game. The rebase only brought in the BlockRegistry review fixes from develop; it was not re-run on a server afterwards.
  • Compatibility with other versions is backed only by a signature comparison of paper-api jars: no removed signatures from 1.20.6 to 26.3. The plugin has not been run on 1.20.6 or 26.x.

🤖 Generated with Claude Code

@osipxd osipxd added this to the Next milestone Nov 8, 2026
@codacy-production

codacy-production Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 88 complexity · -4 duplication

Metric Results
Complexity 88
Duplication -4

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

osipxd and others added 2 commits November 8, 2026 14:50
Replace CommandAPI with Paper's Brigadier command API registered via
LifecycleEvents.COMMANDS, so the CommandAPI plugin is no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Operators have every permission implicitly, so they had all classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@osipxd
osipxd force-pushed the feature/brigadier-commands branch from 196fbb1 to 1d375d5 Compare November 8, 2026 13:51
@osipxd osipxd changed the title Migrate /mimic commands to Paper Brigadier API Improve /mimic commands UX via Paper Brigadier API Nov 8, 2026

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

Unresolved issues risk losing original blocks when replacement fails and corrupting player XP with non-finite amounts, while also breaking empty-value resets for preferred providers.

3 open issues
What changed in this PR

Migrates /mimic commands to Paper’s native Brigadier API, removing the CommandAPI plugin requirement while updating command syntax and feedback.

Changes:

  • Registers commands through Paper lifecycle events and removes CommandAPI dependencies and fallback handling.
  • Reworks command arguments, suggestions, validation, and interactive output.
  • Requires explicitly set class permissions and adds a regression test for operator defaults.
File Description
mimic-bukkit/​src/​test/​kotlin/​impl/​mimic/​PermissionsClassSystemTest.kt Tests explicit class permissions and operator defaults.
mimic-bukkit/​src/​main/​kotlin/​MimicPlugin.kt Uses native command registration.
mimic-bukkit/​src/​main/​kotlin/​impl/​mimic/​PermissionsClassSystem.kt Requires explicitly set class permissions.
mimic-bukkit/​src/​main/​kotlin/​command/​textUserInterface.kt Adds headers, verdicts, copyable IDs, and command hints.
mimic-bukkit/​src/​main/​kotlin/​command/​MimicCommands.kt Removes the CommandAPI registration wrapper.
mimic-bukkit/​src/​main/​kotlin/​command/​MainCommand.kt Registers the Brigadier tree through Paper lifecycle events.
mimic-bukkit/​src/​main/​kotlin/​command/​LevelSystemSubcommand.kt Introduces signed XP values with unit suffixes.
mimic-bukkit/​src/​main/​kotlin/​command/​ItemsSubcommand.kt Reorders give arguments and separates item payloads.
mimic-bukkit/​src/​main/​kotlin/​command/​InventorySubcommand.kt Migrates inventory commands and adds default info output.
mimic-bukkit/​src/​main/​kotlin/​command/​FallbackCommand.kt Removes the CommandAPI installation prompt.
mimic-bukkit/​src/​main/​kotlin/​command/​ConfigMessage.kt Uses the shared header helper.
mimic-bukkit/​src/​main/​kotlin/​command/​ConfigCommand.kt Migrates configuration commands and validates values.
mimic-bukkit/​src/​main/​kotlin/​command/​ClassSystemSubcommand.kt Migrates class commands and sends results to the sender.
mimic-bukkit/​src/​main/​kotlin/​command/​brigadier.kt Adds command builders, resolvers, parsers, and suggestions.
mimic-bukkit/​src/​main/​kotlin/​command/​BlocksSubcommand.kt Adds replacement behavior and targeted-block defaults.
mimic-bukkit/​build.gradle.kts Removes CommandAPI dependencies and development-server setup.
mimic-bukkit/​api/​mimic-bukkit.api Updates the API snapshot after removing onDisable.
gradle/​libs.versions.toml Removes CommandAPI catalog entries.
CHANGELOG.md Documents migration, syntax changes, and permission behavior.

Review effort: Balanced

Comment on lines +161 to +162
blockRegistry.breakBlock(target, tool = null, DropsConsumer.disappear()) &&
blockRegistry.setBlock(target, block, payload)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated in 3b2eeb5: the error now says the original block was removed when the new one could not be set. Reverting is not possible for custom registries, because BlockRegistry has no snapshot API.

@osipxd
osipxd force-pushed the feature/brigadier-commands branch from 1d375d5 to 3b2eeb5 Compare November 9, 2026 10:19
@osipxd
osipxd requested a balanced review from Copilot November 9, 2026 10:26

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

Inventory.addItem can mutate itemStack.amount, causing incorrect quantity warnings and success messages unless the original amount is captured before insertion.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment on lines +165 to +172
target.inventory.addItem(itemStack)
sender.sendMessage(successText {
append("Gave ${itemStack.amount} ")
appendId(item)
append(" to ${target.name}.")
})
if (itemStack.amount < amount) {
sender.sendMessage(warningText("Requested $amount, but only ${itemStack.amount} can be given at once."))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in c469d08: the amount is now captured before addItem and used for both the success message and the warning.

- Show group info by default, with headers and clickable command hints
- Colour verdicts, report failures as command errors, copy IDs on click
- Key-type item and block arguments with a separate payload, namespace-aware
  substring suggestions with tooltips and hints for empty input
- `items give` in vanilla order with optional amount, warn about clamped amount
- `blocks set` replaces an occupied block, `blocks break` and `blocks compare`
  default to the targeted block and the held item
- New `xp` value syntax `[+|-]<amount>[L|P|T]`, remove `xp has`
- Validate `/mimic config` values
- Remove `experience` and `inv` aliases, `items id` and `blocks id`

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@osipxd
osipxd force-pushed the feature/brigadier-commands branch from 3b2eeb5 to c469d08 Compare November 9, 2026 11:53
@osipxd
osipxd enabled auto-merge (rebase) November 9, 2026 11:54
@osipxd
osipxd merged commit 5eefd0c into develop Nov 9, 2026
3 checks passed
@osipxd
osipxd deleted the feature/brigadier-commands branch November 9, 2026 11:55
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.

2 participants