CommandAPI 9.6.0
An API for the command UI introduced in Minecraft 1.13
dev.jorel.commandapi.StringTooltip Class Reference

Represents a suggestion for an argument with a hover tooltip text for that suggestion. More...

+ Inheritance diagram for dev.jorel.commandapi.StringTooltip:

Public Member Functions

String getSuggestion ()
 Returns the current suggestion that this class holds. More...
 
Message getTooltip ()
 Returns the current tooltip text that this class holds. More...
 

Static Public Member Functions

static StringTooltip ofString (String suggestion, String tooltip)
 Constructs a StringTooltip with a suggestion and a string tooltip. More...
 
static StringTooltip ofMessage (String suggestion, Message tooltip)
 Constructs a StringTooltip with a suggestion and a formatted tooltip. More...
 
static StringTooltip none (String suggestion)
 Constructs a StringTooltip with a suggestion and no tooltip. More...
 
static Collection< StringTooltipnone (String... suggestions)
 Constructs a collection of StringTooltip objects from an array of suggestions, and no tooltips. More...
 
static Collection< StringTooltipnone (Collection< String > suggestions)
 Constructs a collection of StringTooltip objects from a collection of suggestions, and no tooltips. More...
 
static Collection< StringTooltipgenerateStrings (UnaryOperator< String > tooltipGenerator, String... suggestions)
 Constructs a collection of StringTooltip objects from an array of suggestions, and a function which generates a string tooltip for each suggestion. More...
 
static Collection< StringTooltipgenerateStrings (UnaryOperator< String > tooltipGenerator, Collection< String > suggestions)
 Constructs a collection of StringTooltip objects from a collection of suggestions, and a function which generates a string tooltip for each suggestion. More...
 
static Collection< StringTooltipgenerateMessages (Function< String, Message > tooltipGenerator, String... suggestions)
 Constructs a collection of StringTooltip objects from an array of suggestions, and a function which generates a formatted tooltip for each suggestion. More...
 
static Collection< StringTooltipgenerateMessages (Function< String, Message > tooltipGenerator, Collection< String > suggestions)
 Constructs a collection of StringTooltip objects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestion. More...
 

Protected Member Functions

 StringTooltip (String suggestion, Message tooltip)
 

Static Protected Member Functions

static< T > Collection< StringTooltipgenerate (Function< String, T > tooltipGenerator, BiFunction< String, T, StringTooltip > tooltipWrapper, String... suggestions)
 Internal base method for the other generation types. More...
 
static< T > Collection< StringTooltipgenerate (Function< String, T > tooltipGenerator, BiFunction< String, T, StringTooltip > tooltipWrapper, Collection< String > suggestions)
 Internal base method for the other generation types. More...
 
static< T > Collection< StringTooltipgenerate (Function< String, T > tooltipGenerator, BiFunction< String, T, StringTooltip > tooltipWrapper, Stream< String > suggestions)
 Internal base method for the other generation types. More...
 

Detailed Description

Represents a suggestion for an argument with a hover tooltip text for that suggestion.

This class is to be used with normal suggestion overrides, via the Argument.overrideSuggestionsT method.

Member Function Documentation

◆ generate() [1/3]

static< T > Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generate ( Function< String, T >  tooltipGenerator,
BiFunction< String, T, StringTooltip tooltipWrapper,
Collection< String >  suggestions 
)
staticprotected

Internal base method for the other generation types.

Parameters
<T>the type of the tooltip
tooltipGeneratortooltip generation function
tooltipWrapperfunction which wraps suggestion and tooltip into a StringTooltip object
suggestionscollection of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestion, wrapped using the above functions

◆ generate() [2/3]

static< T > Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generate ( Function< String, T >  tooltipGenerator,
BiFunction< String, T, StringTooltip tooltipWrapper,
Stream< String >  suggestions 
)
staticprotected

Internal base method for the other generation types.

Parameters
<T>the type of the tooltip
tooltipGeneratortooltip generation function
tooltipWrapperfunction which wraps suggestion and tooltip into a StringTooltip object
suggestionsstream of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestion, wrapped using the above functions

◆ generate() [3/3]

static< T > Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generate ( Function< String, T >  tooltipGenerator,
BiFunction< String, T, StringTooltip tooltipWrapper,
String...  suggestions 
)
staticprotected

Internal base method for the other generation types.

Parameters
<T>the type of the tooltip
tooltipGeneratortooltip generation function
tooltipWrapperfunction which wraps suggestion and tooltip into a StringTooltip object
suggestionsarray of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestion, wrapped using the above functions

◆ generateMessages() [1/2]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generateMessages ( Function< String, Message tooltipGenerator,
Collection< String >  suggestions 
)
static

Constructs a collection of StringTooltip objects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestion.

Parameters
tooltipGeneratorfunction which returns a formatted tooltip for the suggestion
suggestionscollection of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestions, with the generated formatted tooltips

◆ generateMessages() [2/2]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generateMessages ( Function< String, Message tooltipGenerator,
String...  suggestions 
)
static

Constructs a collection of StringTooltip objects from an array of suggestions, and a function which generates a formatted tooltip for each suggestion.

Parameters
tooltipGeneratorfunction which returns a formatted tooltip for the suggestion
suggestionsarray of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestions, with the generated formatted tooltips

◆ generateStrings() [1/2]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generateStrings ( UnaryOperator< String >  tooltipGenerator,
Collection< String >  suggestions 
)
static

Constructs a collection of StringTooltip objects from a collection of suggestions, and a function which generates a string tooltip for each suggestion.

Parameters
tooltipGeneratorfunction which returns a string tooltip for the suggestion
suggestionscollection of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestions, with the generated string tooltips

◆ generateStrings() [2/2]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.generateStrings ( UnaryOperator< String >  tooltipGenerator,
String...  suggestions 
)
static

Constructs a collection of StringTooltip objects from an array of suggestions, and a function which generates a string tooltip for each suggestion.

Parameters
tooltipGeneratorfunction which returns a string tooltip for the suggestion
suggestionsarray of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the provided suggestions, with the generated string tooltips

◆ getSuggestion()

String dev.jorel.commandapi.StringTooltip.getSuggestion ( )

Returns the current suggestion that this class holds.

Returns
the current suggestion that this class holds

Implements dev.jorel.commandapi.IStringTooltip.

◆ getTooltip()

Message dev.jorel.commandapi.StringTooltip.getTooltip ( )

Returns the current tooltip text that this class holds.

Returns
the current tooltip text that this class holds

Implements dev.jorel.commandapi.IStringTooltip.

◆ none() [1/3]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.none ( Collection< String >  suggestions)
static

Constructs a collection of StringTooltip objects from a collection of suggestions, and no tooltips.

Parameters
suggestionscollection of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the suggestions, with no tooltips

◆ none() [2/3]

static StringTooltip dev.jorel.commandapi.StringTooltip.none ( String  suggestion)
static

Constructs a StringTooltip with a suggestion and no tooltip.

Parameters
suggestionthe suggestion to provide to the user
Returns
a StringTooltip representing this suggestion

◆ none() [3/3]

static Collection< StringTooltip > dev.jorel.commandapi.StringTooltip.none ( String...  suggestions)
static

Constructs a collection of StringTooltip objects from an array of suggestions, and no tooltips.

Parameters
suggestionsarray of suggestions to provide to the user
Returns
a collection of StringTooltip objects from the suggestions, with no tooltips

◆ ofMessage()

static StringTooltip dev.jorel.commandapi.StringTooltip.ofMessage ( String  suggestion,
Message  tooltip 
)
static

Constructs a StringTooltip with a suggestion and a formatted tooltip.

Parameters
suggestionthe suggestion to provide to the user
tooltipthe formatted tooltip to show to the user when they hover over the suggestion
Returns
a StringTooltip representing this suggestion and tooltip

◆ ofString()

static StringTooltip dev.jorel.commandapi.StringTooltip.ofString ( String  suggestion,
String  tooltip 
)
static

Constructs a StringTooltip with a suggestion and a string tooltip.

Parameters
suggestionthe suggestion to provide to the user
tooltipthe string tooltip to show to the user when they hover over the suggestion
Returns
a StringTooltip representing this suggestion and tooltip