Skip to content

Conversation

MC-XiaoHei
Copy link
Member

@MC-XiaoHei MC-XiaoHei commented Aug 22, 2025

resolves #712

使用准将重构了命令系统。
新功能:

  • 现在可以使用/bot config <name>查看某个 bot 的所有 config
  • 现在命令回显部分文字可以 hover 以获取更多信息
  • 现在命令更健全的参数检查以及更明确的 arg name 提示

破坏性更改:

  • 更改了/bot remove的定时移除参数格式,现在的格式如/bot remove test 1h2m3s
  • 更改了/leaves blockupdate命令的使用方式,现在/leaves blockupdate返回方块更新状态,/leaves blockupdate enable/disable更改状态

@MC-XiaoHei MC-XiaoHei changed the title feat: neo command feat: new command system Aug 23, 2025
@MC-XiaoHei MC-XiaoHei marked this pull request as ready for review August 24, 2025 07:16
@MC-XiaoHei MC-XiaoHei requested a review from Copilot August 24, 2025 08:14
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request implements a complete refactor of the command system using Brigadier and introduces several new features and enhancements. The main purpose is to modernize the command handling architecture with more robust argument parsing and validation.

Key changes include:

  • Complete rewrite of command system using Brigadier for better argument validation and suggestions
  • New command structure with /bot config <name> for viewing bot configurations
  • Enhanced command feedback with hover tooltips for additional information
  • Breaking changes to bot removal timing format (now 1h2m3s instead of separate hour/minute/second arguments)

Reviewed Changes

Copilot reviewed 98 out of 98 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
CraftTimerBotAction.java Updated to use AbstractTimerBotAction instead of ServerTimerBotAction
CraftBotAction.java Changed from ServerBotAction to AbstractBotAction for consistency
CraftBotManager.java Updated action retrieval to use new AbstractBotAction hierarchy
CraftBot.java Modified to work with AbstractBotAction and improved remove method return handling
UpdateCommand.java Moved and rewritten using new Brigadier-based command structure
ReloadCommand.java Migrated to new command system with improved message handling
CounterCommand.java Complete rewrite using hierarchical command nodes and better state management
ConfigCommand.java New implementation with path/value argument validation and suggestions
BlockUpdateCommand.java Restructured with enable/disable subcommands and broadcast improvements
Various bot command files Comprehensive refactor to use new CustomArgumentNode and CommandContext system
Bot action classes Updated to use AbstractBotAction base class and new argument system
Bot config classes Refactored to use Brigadier ArgumentType and CommandContext for better type safety
Comments suppressed due to low confidence (2)

leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java:1

  • There's a double possessive apostrophe - bot.getDisplayName() already gets the possessive 's appended, then another 's is added, resulting in "BotName's's action list cleared".
package org.leavesmc.leaves.command.bot.subcommands;

leaves-server/src/main/java/org/leavesmc/leaves/command/bot/subcommands/RemoveCommand.java:1

  • Same double possessive apostrophe issue as above - results in "BotName's's action list".
package org.leavesmc.leaves.command.bot.subcommands;

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Lumine1909
Lumine1909 previously approved these changes Aug 24, 2025
Copy link
Member

@Lumine1909 Lumine1909 left a comment

Choose a reason for hiding this comment

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

我觉得没什么问题了
测试过 @s-yh-china 看过 就合吧(

@MC-XiaoHei MC-XiaoHei requested a review from s-yh-china August 24, 2025 08:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

# Conflicts:
#	leaves-server/src/main/java/org/leavesmc/leaves/LeavesConfig.java
Copy link
Member Author

@MC-XiaoHei MC-XiaoHei left a comment

Choose a reason for hiding this comment

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

应该没什么问题了吧
@s-yh-china

Image

@MC-XiaoHei MC-XiaoHei linked an issue Sep 21, 2025 that may be closed by this pull request
Copy link
Member

@s-yh-china s-yh-china left a comment

Choose a reason for hiding this comment

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

有一点小问题,剩下格式我改的差不多了

@MC-XiaoHei
Copy link
Member Author

MC-XiaoHei commented Sep 24, 2025

暂时不应该合并
我有点想把custom bot action也做了

Update: 不做了 跑!

@MC-XiaoHei MC-XiaoHei changed the base branch from master to dev/1.21.9 October 1, 2025 08:06
# Conflicts:
#	leaves-server/minecraft-patches/features/0002-Leaves-Server-Config.patch
#	leaves-server/minecraft-patches/features/0055-No-block-update-command.patch
#	leaves-server/minecraft-patches/features/0130-Prevent-loss-of-item-drops-due-to-update-suppression.patch
#	leaves-server/minecraft-patches/features/0136-Lithium-Sleeping-Block-Entity.patch
#	leaves-server/paper-patches/features/0003-Leaves-Server-Config.patch
#	leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerLookAction.java
#	leaves-server/src/main/java/org/leavesmc/leaves/bot/agent/actions/ServerMountAction.java
@MC-XiaoHei MC-XiaoHei merged commit 7d3dad9 into dev/1.21.9 Oct 1, 2025
0 of 2 checks passed
@MC-XiaoHei MC-XiaoHei deleted the dev/new-command branch October 1, 2025 08:13
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.

bot指令权限错误 重构命令系统
4 participants