Function arguments

The FunctionArgument class is used to represent a function or a tag in Minecraft. When retrieving an instance of the argument, it will return a FunctionWrapper[], where each FunctionWrapper consists of a Minecraft function.

Therefore, if a user supplies a single function, the FunctionWrapper[] will be of size 1, and if the user supplies a tag which can consist of multiple functions, the FunctionWrapper[] will consist of the array of functions as declared by that tag.

Example - Minecraft's /function command

Here, we implement Minecraft's /function command which is used to execute a function.

LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
arguments.put("function", new FunctionArgument());

CommandAPI.getInstance().register("runfunction", arguments, (sender, args) -> {
    FunctionWrapper[] functions = (FunctionWrapper[]) args[0];

    //Run all functions that the user stated
    for(FunctionWrapper function : functions) {;