Package dev.jorel.commandapi.arguments
Class SafeOverrideableArgument<T,S>
java.lang.Object
dev.jorel.commandapi.ArgumentTree
dev.jorel.commandapi.arguments.Argument<T>
dev.jorel.commandapi.arguments.SafeOverrideableArgument<T,S>
- Type Parameters:
T- The type of the underlying object that this argument casts toS- A custom type which is represented by this argument. For example, aLocationArgumentwill have a custom typeLocation
- Direct Known Subclasses:
AdvancementArgument,AngleArgument,AxisArgument,BiomeArgument,BooleanArgument,ChatColorArgument,DoubleArgument,EnchantmentArgument,EntityTypeArgument,EnvironmentArgument,FloatArgument,FloatRangeArgument,FunctionArgument,GreedyStringArgument,IntegerArgument,IntegerRangeArgument,ItemStackArgument,Location2DArgument,LocationArgument,LongArgument,LootTableArgument,MathOperationArgument,NamespacedKeyArgument,NBTCompoundArgument,ObjectiveArgument,OfflinePlayerArgument,ParticleArgument,PlayerArgument,PotionEffectArgument,RecipeArgument,RotationArgument,ScoreboardSlotArgument,SoundArgument,TeamArgument,TimeArgument,UUIDArgument
An interface declaring methods required to override argument suggestions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CustomCommandExecutor<?>The CustomCommandExecutor for this executable implementation -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSafeOverrideableArgument(String nodeName, com.mojang.brigadier.arguments.ArgumentType<?> rawType, Function<S, String> mapper) Instantiates this argument and assigns the mapper to the provided mapper -
Method Summary
Modifier and TypeMethodDescriptionClear all executors from the current command builderexecutes(CommandExecutor executor, ExecutorType... types) Adds an executor to the current command builderexecutes(ResultingCommandExecutor executor, ExecutorType... types) Adds an executor to the current command builderAdds an executor to the current command builderAdds an executor to the current command builderexecutesConsole(ConsoleCommandExecutor executor) Adds an executor to the current command builderAdds an executor to the current command builderexecutesEntity(EntityCommandExecutor executor) Adds an executor to the current command builderexecutesEntity(EntityResultingCommandExecutor executor) Adds an executor to the current command builderexecutesNative(NativeCommandExecutor executor) Adds an executor to the current command builderexecutesNative(NativeResultingCommandExecutor executor) Adds an executor to the current command builderexecutesPlayer(PlayerCommandExecutor executor) Adds an executor to the current command builderexecutesPlayer(PlayerResultingCommandExecutor executor) Adds an executor to the current command builderexecutesProxy(ProxyCommandExecutor executor) Adds an executor to the current command builderexecutesProxy(ProxyResultingCommandExecutor executor) Adds an executor to the current command builderCustomCommandExecutor<? extends org.bukkit.command.CommandSender>Returns the executors that this command hasincludeSafeSuggestions(SafeSuggestions<S> suggestions) Includes the suggestions provided with the existing suggestions for this argument.includeWithSafeSuggestions(Function<SuggestionInfo, S[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.includeWithSafeSuggestionsT(Function<SuggestionInfo, Tooltip<S>[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.replaceSafeSuggestions(SafeSuggestions<S> suggestions) Replaces the suggestions with a safeSafeSuggestionsobject.replaceWithSafeSuggestions(Function<SuggestionInfo, S[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.replaceWithSafeSuggestionsT(Function<SuggestionInfo, Tooltip<S>[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.voidsetExecutor(CustomCommandExecutor<? extends org.bukkit.command.CommandSender> executor) Sets the executors for this commandMethods inherited from class dev.jorel.commandapi.arguments.Argument
getArgumentPermission, getArgumentType, getEntityNames, getIncludedSuggestions, getNodeName, getOverriddenSuggestions, getPrimitiveType, getRawType, getRequirements, includeSuggestions, includeSuggestions, includeSuggestionsT, isListed, parseArgument, replaceSuggestions, replaceSuggestions, replaceSuggestionsT, setListed, withPermission, withPermission, withRequirementMethods inherited from class dev.jorel.commandapi.ArgumentTree
then
-
Field Details
-
executor
The CustomCommandExecutor for this executable implementation
-
-
Constructor Details
-
SafeOverrideableArgument
protected SafeOverrideableArgument(String nodeName, com.mojang.brigadier.arguments.ArgumentType<?> rawType, Function<S, String> mapper) Instantiates this argument and assigns the mapper to the provided mapper- Parameters:
nodeName- the node name of this argumentrawType- the NMS raw argument type of this argumentmapper- the mapping function that maps this argument type to a string for suggestions
-
-
Method Details
-
replaceSafeSuggestions
Replaces the suggestions with a safeSafeSuggestionsobject. Use the static methods inSafeSuggestionsto create safe suggestions.- Parameters:
suggestions- The safe suggestions to use- Returns:
- the current argument
-
replaceWithSafeSuggestions
@Deprecated(forRemoval=true) public final Argument<T> replaceWithSafeSuggestions(Function<SuggestionInfo, S[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.Replaces the suggestions of this argument with an array of suggestions.- Parameters:
suggestions- a function that takes inSuggestionInfoand returns aSafeOverrideableArgumentarray of suggestions, where S is your custom type- Returns:
- the current argument
-
replaceWithSafeSuggestionsT
@Deprecated(forRemoval=true) public final Argument<T> replaceWithSafeSuggestionsT(Function<SuggestionInfo, Tooltip<S>[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.Replaces the suggestions of this argument with an array of suggestions.- Parameters:
suggestions- a function that takes inSuggestionInfoand returns aTooltiparray of suggestions, parameterized overSafeOverrideableArgumentwhere S is your custom type- Returns:
- the current argument
-
includeSafeSuggestions
Includes the suggestions provided with the existing suggestions for this argument. Use the static methods inSafeSuggestionsto create safe suggestions.- Parameters:
suggestions- The safe suggestions to use- Returns:
- the current argument
-
includeWithSafeSuggestions
@Deprecated(forRemoval=true) public final Argument<T> includeWithSafeSuggestions(Function<SuggestionInfo, S[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.Include suggestions to add to the list of default suggestions represented by this argument.- Parameters:
suggestions- a function that takes inSuggestionInfowhich includes information about the current state at the time the suggestions are run and returns aSafeOverrideableArgumentarray of suggestions to add, where S is your custom type- Returns:
- the current argument
-
includeWithSafeSuggestionsT
@Deprecated(forRemoval=true) public final Argument<T> includeWithSafeSuggestionsT(Function<SuggestionInfo, Tooltip<S>[]> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.Include suggestions to add to the list of default suggestions represented by this argument.- Parameters:
suggestions- a function that takes inSuggestionInfowhich includes information about the current state at the time the suggestions are run and returns aTooltiparray of suggestions to add, parameterized overSafeOverrideableArgumentwhere S is your custom type- Returns:
- the current argument
-
executes
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(CommandSender, Object[]) -> ()that will be executed when the command is runtypes- A list of executor types to use this executes method for.- Returns:
- this command builder
-
executes
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(CommandSender, Object[]) -> intthat will be executed when the command is runtypes- A list of executor types to use this executes method for.- Returns:
- this command builder
-
executesPlayer
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Player, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesPlayer
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Player, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
executesEntity
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Entity, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesEntity
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Entity, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
executesProxy
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Entity, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesProxy
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(Entity, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
executesCommandBlock
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(BlockCommandSender, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesCommandBlock
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(BlockCommandSender, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
executesConsole
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(BlockCommandSender, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesConsole
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(BlockCommandSender, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
executesNative
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(NativeCommandExecutor, Object[]) -> ()that will be executed when the command is run- Returns:
- this command builder
-
executesNative
Adds an executor to the current command builder- Parameters:
executor- A lambda of type(NativeCommandExecutor, Object[]) -> intthat will be executed when the command is run- Returns:
- this command builder
-
getExecutor
Returns the executors that this command has- Returns:
- the executors that this command has
-
setExecutor
Sets the executors for this command- Parameters:
executor- the executors for this command
-
clearExecutors
Clear all executors from the current command builder- Returns:
- this command builder
-
includeSafeSuggestions(SafeSuggestions)