Class StringArgumentType
java.lang.Object
dev.polv.taleapi.command.argument.StringArgumentType
- All Implemented Interfaces:
ArgumentType<String>
Argument type for string values.
Provides three modes:
word()- Single word (no spaces, stops at whitespace)string()- Quoted string or single wordgreedyString()- Consumes all remaining input
Example Usage
// Single word argument
Command.argument("name", StringArgumentType.word())
// Quoted or single word
Command.argument("message", StringArgumentType.string())
// All remaining input
Command.argument("reason", StringArgumentType.greedyString())
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of string parsing. -
Method Summary
Modifier and TypeMethodDescriptionString[]Returns example values for this argument type.Returns the Java type this argument parses to.getType()Returns the string type mode.Returns a human-readable name for this argument type.static StringArgumentTypeCreates a greedy string argument type (all remaining input).parse(StringReader reader) Parses the argument from the input string.static StringArgumentTypestring()Creates a string argument type (quoted or single word).static StringArgumentTypeword()Creates a word argument type (single word, no spaces).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.polv.taleapi.command.argument.ArgumentType
listSuggestions
-
Method Details
-
word
Creates a word argument type (single word, no spaces).- Returns:
- a new word argument type
-
string
Creates a string argument type (quoted or single word).- Returns:
- a new string argument type
-
greedyString
Creates a greedy string argument type (all remaining input).- Returns:
- a new greedy string argument type
-
getType
Returns the string type mode.- Returns:
- the string type
-
parse
Description copied from interface:ArgumentTypeParses the argument from the input string.- Specified by:
parsein interfaceArgumentType<String>- Parameters:
reader- the string reader positioned at the argument- Returns:
- the parsed value
- Throws:
CommandException- if the argument cannot be parsed
-
getResultType
Description copied from interface:ArgumentTypeReturns the Java type this argument parses to.- Specified by:
getResultTypein interfaceArgumentType<String>- Returns:
- the result type class
-
getTypeName
Description copied from interface:ArgumentTypeReturns a human-readable name for this argument type.Used in error messages and help text.
- Specified by:
getTypeNamein interfaceArgumentType<String>- Returns:
- the type name (e.g., "integer", "string", "player")
-
getExamples
Description copied from interface:ArgumentTypeReturns example values for this argument type.Used for documentation and error messages.
- Specified by:
getExamplesin interfaceArgumentType<String>- Returns:
- an array of example values
-