CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
dev.jorel.commandapi.arguments.SuggestionsBranch< CommandSender > Class Template Reference

This class represents a branch in the suggestions of an argument. More...

Public Member Functions

final SuggestionsBranch< CommandSender > branch (SuggestionsBranch< CommandSender >... branches)
 Adds further branches to this SuggestionsBranch. More...
 
ArgumentSuggestions< CommandSender > getNextSuggestion (CommandSender sender, String... previousArguments) throws CommandSyntaxException
 Gets the next ArgumentSuggestions based on the previous arguments. More...
 
void enforceReplacements (CommandSender sender, String... arguments) throws CommandSyntaxException
 Makes sure the given arguments correspond to the suggestions of this SuggestionsBranch. More...
 

Static Public Member Functions

static< CommandSender > SuggestionsBranch< CommandSender > suggest (ArgumentSuggestions< CommandSender >... suggestions)
 Creates a SuggestionsBranch starting with the given suggestions. More...
 

Detailed Description

This class represents a branch in the suggestions of an argument.

Use SuggestionsBranch#suggest(ArgumentSuggestions...) to add suggestions, then SuggestionsBranch#branch(SuggestionsBranch...) to add more branches.

Member Function Documentation

◆ branch()

final SuggestionsBranch< CommandSender > dev.jorel.commandapi.arguments.SuggestionsBranch< CommandSender >.branch ( SuggestionsBranch< CommandSender >...  branches)

Adds further branches to this SuggestionsBranch.

After going through the suggestions provided by SuggestionsBranch#suggest(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 SuggestionsBranch

◆ enforceReplacements()

void dev.jorel.commandapi.arguments.SuggestionsBranch< CommandSender >.enforceReplacements ( CommandSender  sender,
String...  arguments 
) throws CommandSyntaxException

Makes sure the given arguments correspond to the suggestions of this SuggestionsBranch.

Parameters
senderThe CommandSender the suggestions are being built for
argumentsAn array of arguments to check against the suggestions of this SuggestionsBranch
Exceptions
CommandSyntaxExceptionif the given arguments don't lead to a valid path for this SuggestionsBranch

◆ getNextSuggestion()

ArgumentSuggestions< CommandSender > dev.jorel.commandapi.arguments.SuggestionsBranch< CommandSender >.getNextSuggestion ( CommandSender  sender,
String...  previousArguments 
) throws CommandSyntaxException

Gets the next ArgumentSuggestions based on the previous arguments.

Parameters
senderThe CommandSender the suggestions are being built for
previousArgumentsAn array of previously given arguments that is used to find the next ArgumentSuggestions
Returns
The next ArgumentSuggestions given by this SuggestionsBranch or null if the suggestions should not be overridden
Exceptions
CommandSyntaxExceptionif the given previous arguments don't lead to a valid path for this SuggestionsBranch

◆ suggest()

static< CommandSender > SuggestionsBranch< CommandSender > dev.jorel.commandapi.arguments.SuggestionsBranch< CommandSender >.suggest ( ArgumentSuggestions< CommandSender >...  suggestions)
static

Creates a SuggestionsBranch starting with the given suggestions.

If a suggestions is null, the suggestions at that position will not be overridden.

Parameters
suggestionsAn array of ArgumentSuggestions representing the suggestions. Use the static methods in ArgumentSuggestions to create these.
Returns
a new SuggestionsBranch starting with the given suggestions