4. Arguments - Arpaesis/Armada GitHub Wiki
Arguments are the essentials to building a command's structure. Below is a command with 4 Arguments, all of them required:
public class BasicCommand extends Command<World, Object>
{
public SpawnEntityCommand()
{
this.setName("spawn");
this.addArgument(new RequiredArgument("entityName", ParamType.STRING));
this.addArgument(new RequiredArgument("posX", ParamType.INT));
this.addArgument(new RequiredArgument("posY", ParamType.INT));
this.addArgument(new RequiredArgument("posZ", ParamType.INT));
}
@Override
public Object onExecute(World world, Arguments args)
{
String entityName = args.getString();
int posX = args.getInt();
int posY = args.getInt();
int posZ = args.getInt();
world.spawnEntity(entityName, posX, posY, posZ);
return obj;
}
}
This command spawns an entity upon execution. It expects the user to put the entity's name, and 3 positions that represent the 3 axises x, y, and z.
Tip: There is no limit to the amount of arguments that a command can take. However, it is recommended to keep your arguments to a minimum. Not due to performance issues, but long command chains are bad designs.