Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 652 Bytes

command-tree.md

File metadata and controls

25 lines (20 loc) · 652 Bytes

CommandTreeBase

MinecraftForge/MinecraftForge#3193 引入了一个比较实用的基类:CommandTreeBase,可用于非常快速地实现“子命令”的概念。

public class MyCommandTree extends CommandTreeBase {
    public MyCommandTree() {
        this.addSubcommand(new CommandBase() {
            // ... 省略对 CommandBase 的实现
        });
    }

    @Override
    public String getCommandName() {
        return "";
    }

    @Override
    public String getCommandUsage(ICommandSender sender) {
        return "";
    }
}