Package dev.jorel.commandapi
Class Tooltip<S>
java.lang.Object
dev.jorel.commandapi.Tooltip<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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S> Tooltip<S>[]Constructs aTooltip<S>[] from an array ofTooltip<S>via varargs.static <S> Function<Tooltip<S>,StringTooltip> Constructs a function that maps the currentTooltip<S>into a StringTooltip, using a standard mapping function which is defined for a given argument.static <S> Tooltip<S>none(S object) Constructs aTooltip<S>with a suggestion and no tooltipstatic <S> Tooltip<S>Constructs aTooltip<S>with a suggestion and a tooltip
-
Method Details
-
of
Constructs aTooltip<S>with a suggestion and a tooltip- Type Parameters:
S- the object that the argument suggestions use- Parameters:
object- the suggestion to provide to the usertooltip- the tooltip to show to the user when they hover over the suggestion- Returns:
- a
Tooltip<S>representing this suggestion and tooltip
-
none
Constructs aTooltip<S>with a suggestion and no tooltip- Type Parameters:
S- the object that the argument suggestions use- Parameters:
object- the suggestion to provide to the user- Returns:
- a
Tooltip<S>representing this suggestion
-
arrayOf
Constructs aTooltip<S>[] from an array ofTooltip<S>via varargs. This method takes advantage of Java's varargs to construct a generic array parameterised over S for the purpose of type safety for the safeOverrideSuggestionsT method, because Java doesn't allow you to create generic arrays.- Type Parameters:
S- the object that the argument suggestions use- Parameters:
tooltips- an array ofTooltip<S>to be converted intoTooltip<S>[]- Returns:
- a
Tooltip<S>[] from the providedTooltip<S>
-
build
Constructs a function that maps the currentTooltip<S>into a StringTooltip, using a standard mapping function which is defined for a given argument. This method is used internally by the CommandAPI.- Type Parameters:
S- the object that the argument suggestions use- Parameters:
mapper- a mapping function that converts an S instance into a String- Returns:
- the mapping function from this tooltip into a StringTooltip
-