Package dev.jorel.commandapi
Class StringTooltip
java.lang.Object
dev.jorel.commandapi.StringTooltip
- All Implemented Interfaces:
IStringTooltip
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.-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<StringTooltip>generateAdventureComponents(Function<String, net.kyori.adventure.text.Component> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestionstatic Collection<StringTooltip>generateAdventureComponents(Function<String, net.kyori.adventure.text.Component> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestionstatic Collection<StringTooltip>generateBaseComponents(Function<String, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a formatted tooltip for each suggestionstatic Collection<StringTooltip>generateBaseComponents(Function<String, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestionstatic Collection<StringTooltip>generateMessages(Function<String, com.mojang.brigadier.Message> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a formatted tooltip for each suggestionstatic Collection<StringTooltip>generateMessages(Function<String, com.mojang.brigadier.Message> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestionstatic Collection<StringTooltip>generateStrings(Function<String, String> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a string tooltip for each suggestionstatic Collection<StringTooltip>generateStrings(Function<String, String> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a string tooltip for each suggestionReturns the current suggestion that this class holdscom.mojang.brigadier.MessageReturns the current tooltip text that this class holdsstatic StringTooltipConstructs a StringTooltip with a suggestion and no tooltipstatic Collection<StringTooltip>Constructs a collection ofStringTooltipobjects from an array of suggestions, and no tooltipsstatic Collection<StringTooltip>none(Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and no tooltipsstatic StringTooltipDeprecated, for removal: This API element is subject to removal in a future version.static StringTooltipofAdventureComponent(String suggestion, net.kyori.adventure.text.Component tooltip) Constructs a StringTooltip with a suggestion and a formatted adventure text component tooltipstatic StringTooltipofBaseComponents(String suggestion, net.md_5.bungee.api.chat.BaseComponent... tooltip) Constructs a StringTooltip with a suggestion and a formatted bungee text component tooltipstatic StringTooltipConstructs a StringTooltip with a suggestion and a formatted tooltipstatic StringTooltipConstructs a StringTooltip with a suggestion and a string tooltip
-
Method Details
-
of
Deprecated, for removal: This API element is subject to removal in a future version.please useofString(String, String)insteadConstructs a StringTooltip with a suggestion and a string tooltip- Parameters:
suggestion- the suggestion to provide to the usertooltip- the string tooltip to show to the user when they hover over the suggestion- Returns:
- a StringTooltip representing this suggestion and tooltip
-
ofString
Constructs a StringTooltip with a suggestion and a string tooltip- Parameters:
suggestion- the suggestion to provide to the usertooltip- the string tooltip to show to the user when they hover over the suggestion- Returns:
- a StringTooltip representing this suggestion and tooltip
-
ofMessage
Constructs a StringTooltip with a suggestion and a formatted tooltip- Parameters:
suggestion- the suggestion to provide to the usertooltip- the formatted tooltip to show to the user when they hover over the suggestion- Returns:
- a StringTooltip representing this suggestion and tooltip
-
ofBaseComponents
public static StringTooltip ofBaseComponents(String suggestion, net.md_5.bungee.api.chat.BaseComponent... tooltip) Constructs a StringTooltip with a suggestion and a formatted bungee text component tooltip- Parameters:
suggestion- the suggestion to provide to the usertooltip- the formatted tooltip to show to the user when they hover over the suggestion- Returns:
- a StringTooltip representing this suggestion and tooltip
-
ofAdventureComponent
public static StringTooltip ofAdventureComponent(String suggestion, net.kyori.adventure.text.Component tooltip) Constructs a StringTooltip with a suggestion and a formatted adventure text component tooltip- Parameters:
suggestion- the suggestion to provide to the usertooltip- the formatted tooltip to show to the user when they hover over the suggestion- Returns:
- a StringTooltip representing this suggestion and tooltip
-
none
Constructs a StringTooltip with a suggestion and no tooltip- Parameters:
suggestion- the suggestion to provide to the user- Returns:
- a StringTooltip representing this suggestion
-
none
Constructs a collection ofStringTooltipobjects from an array of suggestions, and no tooltips- Parameters:
suggestions- array of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the suggestions, with no tooltips
-
none
Constructs a collection ofStringTooltipobjects from a collection of suggestions, and no tooltips- Parameters:
suggestions- collection of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the suggestions, with no tooltips
-
generateStrings
public static Collection<StringTooltip> generateStrings(Function<String, String> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a string tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a string tooltip for the suggestionsuggestions- array of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated string tooltips
-
generateStrings
public static Collection<StringTooltip> generateStrings(Function<String, String> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a string tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a string tooltip for the suggestionsuggestions- collection of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated string tooltips
-
generateMessages
public static Collection<StringTooltip> generateMessages(Function<String, com.mojang.brigadier.Message> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a formatted tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestionsuggestions- array of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
generateMessages
public static Collection<StringTooltip> generateMessages(Function<String, com.mojang.brigadier.Message> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestionsuggestions- collection of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
generateBaseComponents
public static Collection<StringTooltip> generateBaseComponents(Function<String, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a formatted tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestion, an array ofBaseComponentssuggestions- array of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
generateBaseComponents
public static Collection<StringTooltip> generateBaseComponents(Function<String, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a formatted tooltip for each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestion, an array ofBaseComponentssuggestions- collection of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
generateAdventureComponents
public static Collection<StringTooltip> generateAdventureComponents(Function<String, net.kyori.adventure.text.Component> tooltipGenerator, String... suggestions) Constructs a collection ofStringTooltipobjects from an array of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestion, an adventureComponentsuggestions- array of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
generateAdventureComponents
public static Collection<StringTooltip> generateAdventureComponents(Function<String, net.kyori.adventure.text.Component> tooltipGenerator, Collection<String> suggestions) Constructs a collection ofStringTooltipobjects from a collection of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Parameters:
tooltipGenerator- function which returns a formatted tooltip for the suggestion, an adventureComponentsuggestions- collection of suggestions to provide to the user- Returns:
- a collection of
StringTooltipobjects from the provided suggestions, with the generated formatted tooltips
-
getSuggestion
Returns the current suggestion that this class holds- Specified by:
getSuggestionin interfaceIStringTooltip- Returns:
- the current suggestion that this class holds
-
getTooltip
public com.mojang.brigadier.Message getTooltip()Returns the current tooltip text that this class holds- Specified by:
getTooltipin interfaceIStringTooltip- Returns:
- the current tooltip text that this class holds
-
ofString(String, String)instead