The CommandAPI offers the CommandTree class as an alternative to the CommandAPICommand when registering commands. The syntax for using it to make a command fits the syntax of a yml file, so I think a new command definition system can be built off of the CommandTree.
For example, the following yml file:
commands:
sayHi:
permission: greet
then:
permission: greet.other
name: <target>
type: Player
executes:
- do <target>.sendMessage(<sender>.toString().join(" says Hi!"))
executes:
- do <sender>.sendMessage("Hi!")
would be roughly equivalent to this CommandTree:
new CommandTree("sayHi")
.withPermission("greet")
.then(new PlayerArgument("target")
.withPermission("greet.other")
.executes((sender, args) -> {
((Player) args[0]).sendMessage(sender.getName() + " says Hi!");
})
)
.executes((sender, args) -> {
sender.sendMessage("Hi");
})
.register();
This new command-definition system would make it easier for users to create subcommands, and make it easier to develop new features from the CommandAPI.
The CommandAPI offers the CommandTree class as an alternative to the CommandAPICommand when registering commands. The syntax for using it to make a command fits the syntax of a yml file, so I think a new command definition system can be built off of the CommandTree.
For example, the following yml file:
would be roughly equivalent to this CommandTree:
This new command-definition system would make it easier for users to create subcommands, and make it easier to develop new features from the CommandAPI.