feat: add rename command and update version to 3.2.4-SNAPSHOT#45
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new /rename command for renaming the item in a player’s main hand, introduces corresponding permissions, and bumps the project version.
Changes:
- Added
/renamecommand with optional MiniMessage parsing gated by a separate permission. - Registered the new command in
PaperCommandManager. - Added new permission nodes and bumped version to
3.2.4-SNAPSHOT.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main/kotlin/dev/slne/surf/essentials/util/permission/EssentialsPermissionRegistry.kt |
Adds permission nodes for the rename command and MiniMessage usage. |
src/main/kotlin/dev/slne/surf/essentials/command/RenameCommand.kt |
Implements the /rename command logic and permission checks. |
src/main/kotlin/dev/slne/surf/essentials/PaperCommandManager.kt |
Registers the new rename command during command setup. |
gradle.properties |
Updates the project version to 3.2.4-SNAPSHOT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val displayName = | ||
| if (player.hasPermission(EssentialsPermissionRegistry.RENAME_COMMAND_MINIMESSAGE)) miniMessage.deserialize( | ||
| content | ||
| ) else Component.text(content) | ||
|
|
||
| item.editMeta { | ||
| it.displayName(displayName) | ||
| } |
There was a problem hiding this comment.
The item display name is set without explicitly disabling the default italic decoration. In this codebase, item display names/lore are consistently forced to non-italic (e.g., ItemEditCommand.kt uses decorationIfAbsent(TextDecoration.ITALIC, FALSE)), otherwise renamed items will appear italicized in-game. Apply the same decoration handling to displayName before calling it.displayName(...) (for both MiniMessage and plain text paths).
| greedyStringArgument("content") { | ||
| playerExecutor { player, arguments -> | ||
| val item = player.inventory.itemInMainHand | ||
| val content: String by arguments |
There was a problem hiding this comment.
The command argument is named content, but other item renaming/editing commands in this project use more specific names like name (see ItemEditCommand.kt's greedyStringArgument("name")). Since this argument name typically shows up in generated command help/usage, consider renaming it to name for consistency and clarity.
No description provided.