Class PhraseArgument
-
- All Implemented Interfaces:
public final class PhraseArgument extends StringArgument
An extension of StringArgument with StringType.PHRASE which allows you to input a phrase and handle each word independently. This allows you to add word suggestions, word executions and word runnables.
-
-
Field Summary
Fields Modifier and Type Field Description private final HashMap<Integer, WordArgument>
words
private AbstractStellarCommand<?>
parent
private final Set<ExecutableExecution<?>>
globalFailureExecutions
private final Set<ExecutableSuggestion<?>>
suggestions
private Integer
suggestionOffset
private final ArgumentType<String>
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 PhraseArgument(String name)
-
Method Summary
Modifier and Type Method Description final HashMap<Integer, WordArgument>
getWords()
final PhraseArgument
addWordArgument(Integer index, Function1<WordArgument, Unit> init)
Creates a WordArgument at the index, that you can configure with init. final PhraseArgument
addWordArgument(Integer index, PhraseFunction init)
Creates a WordArgument at the index, that you can configure with init. final PhraseArgument
addWordArgument(Integer index)
Creates a WordArgument at the index, that you can configure with init. final PhraseArgument
getOrCreateWordArgument(Integer index, Function1<WordArgument, Unit> function)
Gets the WordArgument with the specified index if it exists, otherwise creates one. final PhraseArgument
getOrCreateWordArgument(Integer index, PhraseFunction function)
Gets the WordArgument with the specified index if it exists, otherwise creates one. final <C extends CommandSender> PhraseArgument
setWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Sets the execution for the WordArgument at index. final PhraseArgument
setWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Sets the execution for the WordArgument at index. final <C extends CommandSender> PhraseArgument
addWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Adds an execution to the WordArgument at index. final PhraseArgument
addWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Adds an execution to the WordArgument at index. final <C extends CommandSender> PhraseArgument
addAsyncWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Adds an async execution to the WordArgument at index. final PhraseArgument
addAsyncWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Adds an async execution to the WordArgument at index. final <C extends CommandSender> PhraseArgument
setWordRunnable(Integer index, Function1<PhraseCommandContext<C>, Boolean> runnable)
Sets the runnable for the WordArgument at index. final PhraseArgument
setWordRunnable(Integer index, PhraseRunnable<CommandSender> runnable)
Sets the runnable for the WordArgument at index. final <C extends CommandSender> PhraseArgument
addWordRunnable(Integer index, Function1<PhraseCommandContext<C>, Boolean> runnable)
Adds a runnable to the WordArgument at index. final PhraseArgument
addWordRunnable(Integer index, PhraseRunnable<CommandSender> runnable)
Adds a runnable to the WordArgument at index. final PhraseArgument
setWordSuggestions(Integer index, Suggestion suggestions)
Sets the word suggestions for the WordArgument at index. final PhraseArgument
addWordSuggestions(Integer index, Suggestion suggestions)
Adds word suggestions to the WordArgument at index. final PhraseArgument
addWordSuggestions(Integer index, String suggestions)
Adds word suggestions to the WordArgument at index. -
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
-
PhraseArgument
PhraseArgument(String name)
-
-
Method Detail
-
getWords
final HashMap<Integer, WordArgument> getWords()
-
addWordArgument
final PhraseArgument addWordArgument(Integer index, Function1<WordArgument, Unit> init)
Creates a WordArgument at the index, that you can configure with init. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
addWordArgument
@JvmOverloads() final PhraseArgument addWordArgument(Integer index, PhraseFunction init)
Creates a WordArgument at the index, that you can configure with init.
- Returns:
The modified PhraseArgument instance.
-
addWordArgument
@JvmOverloads() final PhraseArgument addWordArgument(Integer index)
Creates a WordArgument at the index, that you can configure with init.
- Returns:
The modified PhraseArgument instance.
-
getOrCreateWordArgument
final PhraseArgument getOrCreateWordArgument(Integer index, Function1<WordArgument, Unit> function)
Gets the WordArgument with the specified index if it exists, otherwise creates one. You can then configure the WordArgument with function.
This only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
getOrCreateWordArgument
final PhraseArgument getOrCreateWordArgument(Integer index, PhraseFunction function)
Gets the WordArgument with the specified index if it exists, otherwise creates one. You can then configure the WordArgument with function.
- Returns:
The modified PhraseArgument instance.
-
setWordExecution
final <C extends CommandSender> PhraseArgument setWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Sets the execution for the WordArgument at index. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
setWordExecution
final PhraseArgument setWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Sets the execution for the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
addWordExecution
final <C extends CommandSender> PhraseArgument addWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Adds an execution to the WordArgument at index. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
addWordExecution
final PhraseArgument addWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Adds an execution to the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
addAsyncWordExecution
final <C extends CommandSender> PhraseArgument addAsyncWordExecution(Integer index, Function1<PhraseCommandContext<C>, Unit> execution)
Adds an async execution to the WordArgument at index. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
addAsyncWordExecution
final PhraseArgument addAsyncWordExecution(Integer index, PhraseExecution<CommandSender> execution)
Adds an async execution to the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
setWordRunnable
final <C extends CommandSender> PhraseArgument setWordRunnable(Integer index, Function1<PhraseCommandContext<C>, Boolean> runnable)
Sets the runnable for the WordArgument at index. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
setWordRunnable
final PhraseArgument setWordRunnable(Integer index, PhraseRunnable<CommandSender> runnable)
Sets the runnable for the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
addWordRunnable
final <C extends CommandSender> PhraseArgument addWordRunnable(Integer index, Function1<PhraseCommandContext<C>, Boolean> runnable)
Adds a runnable to the WordArgument at index. Only works in Kotlin.
- Returns:
The modified PhraseArgument instance.
-
addWordRunnable
final PhraseArgument addWordRunnable(Integer index, PhraseRunnable<CommandSender> runnable)
Adds a runnable to the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
setWordSuggestions
final PhraseArgument setWordSuggestions(Integer index, Suggestion suggestions)
Sets the word suggestions for the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
addWordSuggestions
final PhraseArgument addWordSuggestions(Integer index, Suggestion suggestions)
Adds word suggestions to the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
addWordSuggestions
final PhraseArgument addWordSuggestions(Integer index, String suggestions)
Adds word suggestions to the WordArgument at index.
- Returns:
The modified PhraseArgument instance.
-
-
-
-