@Flag
To define a flag in a command, use the @Flag
annotation.
java
@Command(name = "mute")
public class MuteCommand {
@Execute
void mute(@Arg Player player, @Flag("-s") boolean isSilent) {
// ..
}
}
@Flag("-s")
declares a flag with the identifier -s
that can be used in the command.
Here is an example of the /mute
command usage:
/mute <player> -s
Input
/mute Rollczi -splayer
RollcziisSilent
trueAdditional Options
You can also define a flag with a different identifier:
java
@Flag("--silent")
Or create more than one flag in the same command:
java
@Flag("-s") boolean isSilent, @Flag("-k") boolean isKick