Arguments
This page describes the concept of Command Arguments
Perhaps the most important part of any command framework is the ability to handle sub commands and command arguments. In this section we'll cover the latter.
Built-In Arguments
For ease of use, there are various built-in arguments for all platforms. Some arguments are also available for certain platforms. Currently, Delegate supports 4 basic arguments out of the box:
Float Argument (
FloatArgument
)Double Argument (
DoubleArgument
)Integer Argument (
IntArgument
)String Argument (
StringArgument
)
These arguments will try and process a given input String to a new type. For example, the FloatArgument
will try to process the input to a floating point number.
Platform-Specific Arguments
As said earlier, there are various platform specific arguments. Currently, the following arguments are supported:
PlayerArgument
WorldArgument
Using Arguments
The actual functionality of arguments is the most important part of this section. As explained in the previous section, command attributes can be added to a command by chaining them. Since arguments are command attributes, they must be chained to this builder. To build up the example, we will need one String argument and two Float arguments. We can add them to the command as follows:
Methods For Providing Arguments
When executing a command, the following formats are supported:
/math + 1 2
/math operation="+" a="1" b="2"
While the first method is very concise, it does not allow for arbitrary arguments to be ommited. By using the second method, arguments will automatically be linked together through the identifier that has been specified.
Last updated