Class ListArgument
-
- All Implemented Interfaces:
public class ListArgument<T extends Object, R extends Object> extends AbstractStellarArgument<ListArgument<T, R>, R>
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided.
-
-
Field Summary
Fields Modifier and Type Field Description private final AbstractStellarArgument<?, R>
base
private final Function1<CommandContext<CommandSender>, Iterable<T>>
list
private final Function2<CommandSender, T, Suggestion>
converter
private final Function2<CommandSender, R, T>
parse
private final Boolean
async
private AbstractStellarCommand<?>
parent
private final Set<ExecutableExecution<?>>
globalFailureExecutions
private final Set<ExecutableSuggestion<?>>
suggestions
private Integer
suggestionOffset
private final ArgumentType<R>
argumentType
private NMS
nms
private final Set<String>
aliases
private final List<ExecutableRequirement<?>>
requirements
private final Set<AbstractStellarArgument<?, ?>>
arguments
private final Set<ExecutableExecution<?>>
executions
private final Set<ExecutableRunnable<?>>
runnables
private final Set<ExecutableExecution<?>>
failureExecutions
private HideDefaultFailureMessages
hideDefaultFailureMessages
private final String
name
-
Constructor Summary
Constructors Constructor Description ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse, Boolean async)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided. ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided. ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, R, T> parse)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided. ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse, Boolean async)
ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse)
ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, R, T> parse)
-
Method Summary
Modifier and Type Method Description final AbstractStellarArgument<?, R>
getBase()
final Function1<CommandContext<CommandSender>, Iterable<T>>
getList()
final Function2<CommandSender, T, Suggestion>
getConverter()
final Function2<CommandSender, R, T>
getParse()
final Boolean
getAsync()
final T
parseInternal(CommandSender sender, Object value)
List<Suggestion>
getSuggestionList(CommandContext<CommandSender> context, String input)
An open function that returns the list of suggestions used in the argument. -
Methods inherited from class com.undefined.stellar.AbstractStellarArgument
addAsyncSuggestion, addAsyncSuggestion, addFutureSuggestion, addFutureSuggestion, addSuggestion, addSuggestion, addSuggestion, addSuggestion, addSuggestionOffset, addSuggestions, addSuggestions, clearInformation, getArgumentType, getGlobalFailureExecutions, getParent, getSuggestionOffset, getSuggestions, hasGlobalHiddenDefaultFailureMessages, register, setDescription, setInformation, setParent, setSuggestionOffset, setSuggestionOffset, setUsageText
-
Methods inherited from class com.undefined.stellar.AbstractStellarCommand
addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAdvancedListArgument, addAlias, addAliases, addAngleArgument, addArgument, addArgument, addAsyncExecution, addAsyncExecution, addAsyncRunnable, addAsyncRunnable, addAxisArgument, addBlockDataArgument, addBlockPredicateArgument, addBooleanArgument, addColorArgument, addComponentArgument, addDisplaySlotArgument, addDoubleArgument, addDoubleArgument, addDoubleArgument, addDoubleRangeArgument, addEntityAnchorArgument, addEntityArgument, addEnumArgument, addEnumArgument, addEnumArgument, addEnumArgument, addEnumArgument, addEnvironmentArgument, addExecution, addExecution, addFailureExecution, addFailureExecution, addFailureMessage, addFailureMessage, addFloatArgument, addFloatArgument, addFloatArgument, addGameModeArgument, addGameProfileArgument, addGlobalFailureExecution, addGlobalFailureExecution, addGlobalFailureMessage, addGlobalFailureMessage, addHeightMapArgument, addIntRangeArgument, addIntegerArgument, addIntegerArgument, addIntegerArgument, addItemSlotArgument, addItemStackArgument, addItemStackPredicateArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addListArgument, addLiteralArgument, addLocationArgument, addLongArgument, addLongArgument, addLongArgument, addLootTableArgument, addMessageArgument, addMirrorArgument, addNamespacedKeyArgument, addObjectiveArgument, addObjectiveCriteriaArgument, addOnlinePlayersArgument, addOnlinePlayersArgument, addOnlinePlayersArgument, addOperationArgument, addParticleArgument, addPhraseArgument, addRequirement, addRequirement, addRequirement, addRequirement, addRequirements, addRequirements, addRotationArgument, addRunnable, addRunnable, addScoreHolderArgument, addStringArgument, addStringArgument, addStructureRotationArgument, addStyleArgument, addTeamArgument, addTimeArgument, addTimeArgument, addUUIDArgument, clearAliases, getAliases, getArguments, getExecutions, getFailureExecutions, getHideDefaultFailureMessages, getName, getNms, getRequirements, getRunnables, hideDefaultFailureMessages, hideDefaultFailureMessages, hideDefaultFailureMessages, setHideDefaultFailureMessages, setNms
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse, Boolean async)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided.- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- The list used in the argument.converter
- A function providing a CommandSender and a value from the list, returning the Suggestion shown in-game.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.async
- Whether the suggestions should be gotten asynchronously (default:false
).
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided.- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- The list used in the argument.converter
- A function providing a CommandSender and a value from the list, returning the Suggestion shown in-game.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Iterable<T> list, Function2<CommandSender, R, T> parse)
An argument that wraps around an AbstractStellarArgument and adds a suggestion based on the list provided.- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- The list used in the argument.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse, Boolean async)
- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- A function providing a CommandContext and returning the list used in the argument.converter
- A function providing a CommandSender and a value from the list, returning the Suggestion shown in-game.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.async
- Whether the suggestions should be gotten asynchronously (default:false
).
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, T, Suggestion> converter, Function2<CommandSender, R, T> parse)
- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- A function providing a CommandContext and returning the list used in the argument.converter
- A function providing a CommandSender and a value from the list, returning the Suggestion shown in-game.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.
-
ListArgument
ListArgument(AbstractStellarArgument<?, R> base, Function1<CommandContext<CommandSender>, Iterable<T>> list, Function2<CommandSender, R, T> parse)
- Parameters:
base
- The AbstractStellarArgument it wraps around.list
- A function providing a CommandContext and returning the list used in the argument.parse
- A function providing a CommandSender and the value returned from the AbstractStellarArgument, returning the argument parsed from the base argument.
-
-
Method Detail
-
getBase
final AbstractStellarArgument<?, R> getBase()
-
getList
final Function1<CommandContext<CommandSender>, Iterable<T>> getList()
-
getConverter
final Function2<CommandSender, T, Suggestion> getConverter()
-
parseInternal
@ApiStatus.Internal() final T parseInternal(CommandSender sender, Object value)
-
getSuggestionList
@ApiStatus.OverrideOnly() List<Suggestion> getSuggestionList(CommandContext<CommandSender> context, String input)
An open function that returns the list of suggestions used in the argument.
Note: This method should only be overridden! This is not meant to be called from the end user.
-
-
-
-