public abstract class PatternMatchingCommandElement extends CommandElement
| Modifier | Constructor and Description | 
|---|---|
protected  | 
PatternMatchingCommandElement(Text key)  | 
protected  | 
PatternMatchingCommandElement(Text key,
                             boolean yesIWantRegex)  | 
| Modifier and Type | Method and Description | 
|---|---|
List<String> | 
complete(CommandSource src,
        CommandArgs args,
        CommandContext context)
Fetch completions for command arguments. 
 | 
protected abstract Iterable<String> | 
getChoices(CommandSource source)
Gets the available choices for this command source. 
 | 
protected Optional<Object> | 
getExactMatch(Iterable<String> choices,
             String potentialChoice)
Tests a string against a set of valid choices to see if it is a
 case-insensitive match. 
 | 
protected abstract Object | 
getValue(String choice)
Gets the value for a given choice. 
 | 
protected Object | 
parseValue(CommandSource source,
          CommandArgs args)
Attempt to extract a value for this element from the given arguments. 
 | 
getKey, getUntranslatedKey, getUsage, parseprotected PatternMatchingCommandElement(@Nullable Text key, boolean yesIWantRegex)
yesIWantRegex - Specify if you want to allow regex for users of
 the command element. Note that this will open up for DoS attacks.@Nullable protected Object parseValue(CommandSource source, CommandArgs args) throws ArgumentParseException
CommandElementCommandSource
 in any way.parseValue in class CommandElementsource - The source to parse forargs - the argumentsArgumentParseException - if unable to extract a valuepublic List<String> complete(CommandSource src, CommandArgs args, CommandContext context)
CommandElementcomplete in class CommandElementsrc - The source requesting tab completionsargs - The arguments currently providedcontext - The context to store state inprotected Optional<Object> getExactMatch(Iterable<String> choices, String potentialChoice)
choices - The choices available to match againstpotentialChoice - The potential choiceOptional containing the matched valueprotected abstract Iterable<String> getChoices(CommandSource source)
source - The source requesting choicesprotected abstract Object getValue(String choice) throws IllegalArgumentException
getChoices(CommandSource), this must return a non-null value.
 Otherwise, an IllegalArgumentException may be throw.choice - The specified choiceIllegalArgumentException - if the input string is not any return
         value of getChoices(CommandSource)