@Commander(
name = "calculate",
description = "test calculate command",
alias = {"cal", "c"}
)
public class TestCalculateCommand implements CommandNode {
@Override
public void execute(CommandSender commandSender) {
}
}
@Commander(
name = "add",
description = "calculate add command",
alias = {"ad", "plus", "a"}
)
public class TestCalculateAddCommand implements CommandNode {
@CommandArg(order = 0)
private int one;
@CommandArg(order = 1)
private int two;
@Override
public void execute(CommandSender commandSender) {
commandSender.sendMessage(one+" + "+two+" = "+(one + two));
}
}
@Commander(
name = "minus",
description = "minus command",
alias = {"reduce", "m"}
)
public class TestCalculateMinusCommand implements CommandNode {
@CommandArg(order = 0)
private int one;
@CommandArg(order = 1)
private int two;
@Override
public void execute(CommandSender commandSender) {
commandSender.sendMessage(one+" - "+two+" = "+(one - two));
}
}
@CommandArg(order = 0, labels = {"first value"})
private int one;
@CommandArg(order = 1, labels = {"second value"}, optional = true)
private int two = 22;
@Commander(
name = "add",
description = "calculate add command",
alias = {"ad", "plus", "a"}
)
public class TestCalculateAddCommand implements CommandNode {
@CommandArg(order = 0)
private int one;
@CommandArg(order = 1)
private int two;
@RemainArgs
private List<String> args;
@Override
public void execute(CommandSender commandSender) {
commandSender.sendMessage(one+" + "+two+" = "+(one + two));
commandSender.sendMessage("remainArgs: "+args.toString());
}
}
1 + 1 = 2
remainArgs: [a, b, c, d, e]