Package dev.jorel.commandapi.arguments
Class CommandArgument
java.lang.Object
dev.jorel.commandapi.AbstractArgumentTree<Argument<CommandResult>,Argument<?>,org.bukkit.command.CommandSender>
dev.jorel.commandapi.arguments.AbstractArgument<CommandResult,Argument<CommandResult>,Argument<?>,org.bukkit.command.CommandSender>
dev.jorel.commandapi.arguments.Argument<CommandResult>
dev.jorel.commandapi.arguments.CommandArgument
- All Implemented Interfaces:
GreedyArgument,BukkitExecutable<Argument<CommandResult>>,ChainableBuilder<Argument<CommandResult>>,PlatformExecutable<Argument<CommandResult>,org.bukkit.command.CommandSender>
An argument that represents a command. This allows users
to enter the name and arguments of any other command as
an argument to this command.
- Since:
- 8.6.0
- API Note:
- Returns a
CommandResultobject
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandAPIExecutor<org.bukkit.command.CommandSender, AbstractCommandSender<? extends org.bukkit.command.CommandSender>> -
Constructor Summary
ConstructorsConstructorDescriptionCommandArgument(String nodeName) Constructs aCommandArgumentwith the given node name. -
Method Summary
Modifier and TypeMethodDescriptionfinal Argument<CommandResult> branchSuggestions(SuggestionsBranch<org.bukkit.command.CommandSender>... branches) AddsSuggestionsBranchto this CommandArgument.CommandAPIExecutor<org.bukkit.command.CommandSender, AbstractCommandSender<? extends org.bukkit.command.CommandSender>> <CommandSourceStack>
CommandResultparseArgument(com.mojang.brigadier.context.CommandContext<CommandSourceStack> cmdCtx, String key, CommandArguments previousArgs) replaceSuggestions(ArgumentSuggestions<org.bukkit.command.CommandSender> suggestions) Replaces the default command suggestions provided by the server with custom suggestions for each argument in the command, starting with the command's name.final CommandArgumentreplaceSuggestions(ArgumentSuggestions<org.bukkit.command.CommandSender>... suggestions) Replaces the default command suggestions provided by the server with custom suggestions for each argument in the command, starting with the command's name.voidsetExecutor(CommandAPIExecutor<org.bukkit.command.CommandSender, AbstractCommandSender<? extends org.bukkit.command.CommandSender>> arg0) Methods inherited from class dev.jorel.commandapi.arguments.AbstractArgument
combineWith, copyPermissionsAndRequirements, getArgumentPermission, getCombinedArguments, getEntityNames, getHelpString, getIncludedSuggestions, getNodeName, getOverriddenSuggestions, getRawType, getRequirements, hasCombinedArguments, includeSuggestions, isListed, isOptional, setListed, setOptional, toString, withPermission, withPermission, withRequirementMethods inherited from class dev.jorel.commandapi.AbstractArgumentTree
thenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.BukkitExecutable
executes, executes, executes, executes, executesCommandBlock, executesCommandBlock, executesCommandBlock, executesCommandBlock, executesConsole, executesConsole, executesConsole, executesConsole, executesEntity, executesEntity, executesEntity, executesEntity, executesFeedbackForwarding, executesFeedbackForwarding, executesFeedbackForwarding, executesFeedbackForwarding, executesNative, executesNative, executesNative, executesNative, executesPlayer, executesPlayer, executesPlayer, executesPlayer, executesProxy, executesProxy, executesProxy, executesProxy, executesRemoteConsole, executesRemoteConsole, executesRemoteConsole, executesRemoteConsoleMethods inherited from interface dev.jorel.commandapi.PlatformExecutable
getExecutor
-
Field Details
-
executor
protected CommandAPIExecutor<org.bukkit.command.CommandSender,AbstractCommandSender<? extends org.bukkit.command.CommandSender>> executor
-
-
Constructor Details
-
CommandArgument
Constructs aCommandArgumentwith the given node name.- Parameters:
nodeName- the name of the node for this argument
-
-
Method Details
-
replaceSuggestions
@SafeVarargs public final CommandArgument replaceSuggestions(ArgumentSuggestions<org.bukkit.command.CommandSender>... suggestions) Replaces the default command suggestions provided by the server with custom suggestions for each argument in the command, starting with the command's name. If a suggestion is null or there isn't any suggestions given for that argument, the suggestions will not be overridden.- Parameters:
suggestions- An array ofArgumentSuggestionsrepresenting the suggestions. Use the static methods in ArgumentSuggestions to create these.- Returns:
- the current argument
-
replaceSuggestions
public CommandArgument replaceSuggestions(ArgumentSuggestions<org.bukkit.command.CommandSender> suggestions) Replaces the default command suggestions provided by the server with custom suggestions for each argument in the command, starting with the command's name. If a suggestion is null or there isn't any suggestions given for that argument, the suggestions will not be overridden.- Overrides:
replaceSuggestionsin classAbstractArgument<CommandResult,Argument<CommandResult>, Argument<?>, org.bukkit.command.CommandSender> - Parameters:
suggestions- An array ofArgumentSuggestionsrepresenting the suggestions. Use the static methods in ArgumentSuggestions to create these.- Returns:
- the current argument
-
branchSuggestions
@SafeVarargs public final Argument<CommandResult> branchSuggestions(SuggestionsBranch<org.bukkit.command.CommandSender>... branches) AddsSuggestionsBranchto this CommandArgument. After going through the suggestions provided byreplaceSuggestions(ArgumentSuggestions...)the suggestions of these branches will be used.- Parameters:
branches- An array ofSuggestionsBranchrepresenting the branching suggestions. UseSuggestionsBranch.suggest(ArgumentSuggestions...)to start creating these.- Returns:
- the current argument
-
getPrimitiveType
- Specified by:
getPrimitiveTypein classAbstractArgument<CommandResult,Argument<CommandResult>, Argument<?>, org.bukkit.command.CommandSender>
-
getArgumentType
- Specified by:
getArgumentTypein classAbstractArgument<CommandResult,Argument<CommandResult>, Argument<?>, org.bukkit.command.CommandSender>
-
parseArgument
public <CommandSourceStack> CommandResult parseArgument(com.mojang.brigadier.context.CommandContext<CommandSourceStack> cmdCtx, String key, CommandArguments previousArgs) throws com.mojang.brigadier.exceptions.CommandSyntaxException - Specified by:
parseArgumentin classAbstractArgument<CommandResult,Argument<CommandResult>, Argument<?>, org.bukkit.command.CommandSender> - Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
getExecutor
public CommandAPIExecutor<org.bukkit.command.CommandSender,AbstractCommandSender<? extends org.bukkit.command.CommandSender>> getExecutor() -
setExecutor
public void setExecutor(CommandAPIExecutor<org.bukkit.command.CommandSender, AbstractCommandSender<? extends org.bukkit.command.CommandSender>> arg0) -
clearExecutors
-