Skip to content

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

Sponsor me
on GitHub

@Arg @CaseInsensitive

If you want an enum argument to be parsed in a case-insensitive manner, use the @CaseInsensitive annotation.

Example

java
@Command(name = "color")
public class ColorCommand {
    @Execute
    void color(@Sender Player player, @Arg @CaseInsensitive Color color) {
        player.sendMessage("Resolved colors as " + color);
    }
    
    private enum Color {
        RED, GREEN, BLUE
    }
}

Here is an example of the /color command usage:

/color <color>
Input
/color red
Output
Resolved colors as RED

Without the @CaseInsensitive

Without the @CaseInsensitive annotation, the /color command accepts only exact enum values (e.g. RED, GREEN). Any other casing will result in an error.

/color <color>
Input
/color red
Output
<Invalid usage error>
The avatar of contributor named as Michał Łuczak Michał Łuczak
The avatar of contributor named as Norbert Dejlich Norbert Dejlich

Made by LiteDevelopers and Contributors with ❤️