Package dev.jorel.commandapi
Class BukkitTooltip<S>
java.lang.Object
dev.jorel.commandapi.Tooltip<S>
dev.jorel.commandapi.BukkitTooltip<S>
- Type Parameters:
S- the object that the argument suggestions use
This class represents a suggestion for an argument with a hover tooltip text
for that suggestion. This class is parameterized over some object S that
represents the safe cast type for argument suggestions. This class is to be
used with safe suggestion overrides, via the
SafeOverrideableArgument.safeOverrideSuggestionsT method.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBukkitTooltip(S object, com.mojang.brigadier.Message tooltip) -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> Collection<Tooltip<S>> generateAdventureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, Collection<S> suggestions) static <S> Collection<Tooltip<S>> generateAdventureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, S... suggestions) static <S> Collection<Tooltip<S>> generateAdvenureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, Collection<S> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.static <S> Collection<Tooltip<S>> generateAdvenureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, S... suggestions) Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated in favour ofgenerateAdventureComponents(Function, Object[])static <S> Collection<Tooltip<S>> generateBaseComponents(Function<S, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, Collection<S> suggestions) static <S> Collection<Tooltip<S>> generateBaseComponents(Function<S, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, S... suggestions) static com.mojang.brigadier.MessagemessageFromAdventureComponent(net.kyori.adventure.text.Component component) Converts a formatted adventure text component to a native minecraft text component which can be used natively by brigadier.static com.mojang.brigadier.MessagemessageFromBaseComponents(net.md_5.bungee.api.chat.BaseComponent... components) Converts a formatted bungee text component to a native minecraft text component which can be used natively by brigadier.static <S> Tooltip<S> ofAdventureComponent(S object, net.kyori.adventure.text.Component tooltip) Constructs aBukkitTooltip<S>with a suggestion and a formatted tooltipstatic <S> Tooltip<S> ofBaseComponents(S object, net.md_5.bungee.api.chat.BaseComponent... tooltip) Constructs aBukkitTooltip<S>with a suggestion and a formatted tooltipMethods inherited from class dev.jorel.commandapi.Tooltip
arrayOf, build, generate, generate, generateMessages, generateMessages, generateStrings, generateStrings, getSuggestion, getTooltip, messageFromString, none, none, none, ofMessage, ofString
-
Constructor Details
-
BukkitTooltip
-
-
Method Details
-
generateBaseComponents
@SafeVarargs public static <S> Collection<Tooltip<S>> generateBaseComponents(Function<S, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, S... suggestions) Constructs a collection ofobjects from an array of suggestions, and a function which generates a tooltip formatted as an array ofBaseComponents for each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
generateBaseComponents
public static <S> Collection<Tooltip<S>> generateBaseComponents(Function<S, net.md_5.bungee.api.chat.BaseComponent[]> tooltipGenerator, Collection<S> suggestions) Constructs a collection ofobjects from a collection of suggestions, and a function which generates a tooltip formatted as an array ofBaseComponents for each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
generateAdvenureComponents
@Deprecated(forRemoval=true, since="9.3.0") @SafeVarargs public static <S> Collection<Tooltip<S>> generateAdvenureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, S... suggestions) Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated in favour ofgenerateAdventureComponents(Function, Object[])Constructs a collection ofobjects from an array of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
generateAdventureComponents
@SafeVarargs public static <S> Collection<Tooltip<S>> generateAdventureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, S... suggestions) Constructs a collection ofobjects from an array of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
generateAdvenureComponents
@Deprecated(forRemoval=true, since="9.3.0") public static <S> Collection<Tooltip<S>> generateAdvenureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, Collection<S> suggestions) Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated in favour ofgenerateAdventureComponents(Function, Collection)Constructs a collection ofobjects from a collection of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
generateAdventureComponents
public static <S> Collection<Tooltip<S>> generateAdventureComponents(Function<S, net.kyori.adventure.text.Component> tooltipGenerator, Collection<S> suggestions) Constructs a collection ofobjects from a collection of suggestions, and a function which generates a tooltip formatted as an adventureComponentfor each suggestion- Type Parameters:
S- the object that the argument suggestions use- 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
objects from the provided suggestions, with the generated formatted tooltips
-
ofBaseComponents
public static <S> Tooltip<S> ofBaseComponents(S object, net.md_5.bungee.api.chat.BaseComponent... tooltip) Constructs aBukkitTooltip<S>with a suggestion and a formatted tooltip- Type Parameters:
S- the object that the argument suggestions use- Parameters:
object- the suggestion to provide to the usertooltip- the formatted tooltip to show to the user when they hover over the suggestion- Returns:
- a
BukkitTooltip<S>representing this suggestion and tooltip
-
ofAdventureComponent
public static <S> Tooltip<S> ofAdventureComponent(S object, net.kyori.adventure.text.Component tooltip) Constructs aBukkitTooltip<S>with a suggestion and a formatted tooltip- Type Parameters:
S- the object that the argument suggestions use- Parameters:
object- the suggestion to provide to the usertooltip- the formatted tooltip to show to the user when they hover over the suggestion- Returns:
- a
BukkitTooltip<S>representing this suggestion and tooltip
-
messageFromBaseComponents
public static com.mojang.brigadier.Message messageFromBaseComponents(net.md_5.bungee.api.chat.BaseComponent... components) Converts a formatted bungee text component to a native minecraft text component which can be used natively by brigadier. This supports all forms of formatting including entity selectors, scores, click & hover events, translations, keybinds and more. Note: the bungee component api is deprecated, and the adventure text component api should be used instead- Parameters:
components- array of bungee text components- Returns:
- native minecraft message object which can be used natively by brigadier.
-
messageFromAdventureComponent
public static com.mojang.brigadier.Message messageFromAdventureComponent(net.kyori.adventure.text.Component component) Converts a formatted adventure text component to a native minecraft text component which can be used natively by brigadier. This supports all forms of formatting including entity selectors, scores, click & hover events, translations, keybinds and more.- Parameters:
component- adventure text component- Returns:
- native minecraft message object which can be used natively by brigadier.
-
generateAdventureComponents(Function, Collection)