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

public class BukkitTooltip<S> extends Tooltip<S>
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 Details

    • BukkitTooltip

      protected BukkitTooltip(S object, com.mojang.brigadier.Message tooltip)
  • 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 of objects from an array of suggestions, and a function which generates a tooltip formatted as an array of BaseComponents 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 of BaseComponents
      suggestions - 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 of objects from a collection of suggestions, and a function which generates a tooltip formatted as an array of BaseComponents 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 of BaseComponents
      suggestions - 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 of generateAdventureComponents(Function, Object[])
      Constructs a collection of objects from an array of suggestions, and a function which generates a tooltip formatted as an adventure Component 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 adventure Component
      suggestions - 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 of objects from an array of suggestions, and a function which generates a tooltip formatted as an adventure Component 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 adventure Component
      suggestions - 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 of generateAdventureComponents(Function, Collection)
      Constructs a collection of objects from a collection of suggestions, and a function which generates a tooltip formatted as an adventure Component 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 adventure Component
      suggestions - 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 of objects from a collection of suggestions, and a function which generates a tooltip formatted as an adventure Component 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 adventure Component
      suggestions - 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 a BukkitTooltip<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 user
      tooltip - 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 a BukkitTooltip<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 user
      tooltip - 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.