Skip to content

Hey there! If you like my work, you can support me by sponsoring me on GitHub. Thanks! ❤

Sponsor me
on GitHub

@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 -s
player
Rollczi
isSilent
true

Additional 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

Made by LiteDevelopers and Contributors with ❤️