Class BooleanArgumentType

java.lang.Object
dev.polv.taleapi.command.argument.BooleanArgumentType
All Implemented Interfaces:
ArgumentType<Boolean>

public class BooleanArgumentType extends Object implements ArgumentType<Boolean>
Argument type for boolean values.

Accepts "true" or "false" (case-insensitive).

Example Usage


 Command.argument("enabled", BooleanArgumentType.bool())
 
  • Method Details

    • bool

      public static BooleanArgumentType bool()
      Returns the boolean argument type instance.
      Returns:
      the boolean argument type
    • parse

      public Boolean parse(StringReader reader) throws CommandException
      Description copied from interface: ArgumentType
      Parses the argument from the input string.
      Specified by:
      parse in interface ArgumentType<Boolean>
      Parameters:
      reader - the string reader positioned at the argument
      Returns:
      the parsed value
      Throws:
      CommandException - if the argument cannot be parsed
    • listSuggestions

      public CompletableFuture<Suggestions> listSuggestions(CommandContext context, SuggestionsBuilder builder)
      Description copied from interface: ArgumentType
      Provides suggestions for this argument.

      Default implementation returns no suggestions.

      Specified by:
      listSuggestions in interface ArgumentType<Boolean>
      Parameters:
      context - the current command context (may have partial arguments)
      builder - the suggestions builder
      Returns:
      a future that completes with suggestions
    • getResultType

      public Class<Boolean> getResultType()
      Description copied from interface: ArgumentType
      Returns the Java type this argument parses to.
      Specified by:
      getResultType in interface ArgumentType<Boolean>
      Returns:
      the result type class
    • getTypeName

      public String getTypeName()
      Description copied from interface: ArgumentType
      Returns a human-readable name for this argument type.

      Used in error messages and help text.

      Specified by:
      getTypeName in interface ArgumentType<Boolean>
      Returns:
      the type name (e.g., "integer", "string", "player")
    • getExamples

      public String[] getExamples()
      Description copied from interface: ArgumentType
      Returns example values for this argument type.

      Used for documentation and error messages.

      Specified by:
      getExamples in interface ArgumentType<Boolean>
      Returns:
      an array of example values