CommandAPI 9.7.0
An API for the command UI introduced in Minecraft 1.13
dev.jorel.commandapi.arguments.CommandArgument Class Reference

An argument that represents a command. More...

+ Inheritance diagram for dev.jorel.commandapi.arguments.CommandArgument:

Public Member Functions

 CommandArgument (String nodeName)
 Constructs a CommandArgument with the given node name. More...
 
final CommandArgument replaceSuggestions (ArgumentSuggestions< 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. More...
 
CommandArgument replaceSuggestions (ArgumentSuggestions< 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. More...
 
final Argument< CommandResult > branchSuggestions (SuggestionsBranch< CommandSender >... branches)
 Adds SuggestionsBranch to this CommandArgument. More...
 
Class< CommandResult > getPrimitiveType ()
 
CommandAPIArgumentType getArgumentType ()
 
Argument< T > instance ()
 Returns the instance of this class with the class Impl. More...
 

Detailed Description

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

@apiNote Returns a CommandResult object

Constructor & Destructor Documentation

◆ CommandArgument()

dev.jorel.commandapi.arguments.CommandArgument.CommandArgument ( String  nodeName)

Constructs a CommandArgument with the given node name.

Parameters
nodeNamethe name of the node for this argument

Member Function Documentation

◆ branchSuggestions()

final Argument< CommandResult > dev.jorel.commandapi.arguments.CommandArgument.branchSuggestions ( SuggestionsBranch< CommandSender >...  branches)

Adds SuggestionsBranch to this CommandArgument.

After going through the suggestions provided by CommandArgument#replaceSuggestions(ArgumentSuggestions...) the suggestions of these branches will be used.

Parameters
branchesAn array of SuggestionsBranch representing the branching suggestions. Use SuggestionsBranch#suggest(ArgumentSuggestions...) to start creating these.
Returns
the current argument

◆ instance()

Argument< T > dev.jorel.commandapi.arguments.Argument< T >.instance ( )
inherited

Returns the instance of this class with the class Impl.

Used for chaining builder methods.

◆ replaceSuggestions() [1/2]

CommandArgument dev.jorel.commandapi.arguments.CommandArgument.replaceSuggestions ( ArgumentSuggestions< 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
suggestionsAn array of ArgumentSuggestions representing the suggestions. Use the static methods in ArgumentSuggestions to create these.
Returns
the current argument

◆ replaceSuggestions() [2/2]

final CommandArgument dev.jorel.commandapi.arguments.CommandArgument.replaceSuggestions ( ArgumentSuggestions< 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
suggestionsAn array of ArgumentSuggestions representing the suggestions. Use the static methods in ArgumentSuggestions to create these.
Returns
the current argument