NBT arguments
The CommandAPI includes support for NBT compounds by using the NBT API by tr7zw. To use NBT, use the NBTCompoundArgument
and simply cast the argument to an NBTContainer
.
Since this argument depends on the NBT API, if this is used and the NBT API is not available on the server, an NBTAPINotFoundException
will be thrown.
Example - ???
LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
arguments.put("nbt", new NBTCompoundArgument());
new CommandAPICommand("award")
.withArguments(arguments)
.executes((sender, args) -> {
NBTContainer nbt = (NBTContainer) args[0];
//Do something with "nbt" here...
})
.register();
Developer's Note:
I haven't personally explored much with using this argument, so this example isn't great. If you believe you can supply a suitable example for this page, feel free to send an example on the CommandAPI issues page.