Package net.kyori.adventure.text.event
Class HoverEvent<V>
java.lang.Object
net.kyori.adventure.text.event.HoverEvent<V>
- Type Parameters:
- V- the value type
- All Implemented Interfaces:
- ComponentBuilderApplicable,- HoverEventSource<V>,- StyleBuilderApplicable,- net.kyori.examination.Examinable
public final class HoverEvent<V> extends Object implements net.kyori.examination.Examinable, HoverEventSource<V>, StyleBuilderApplicable
A hover event.
 
A hover event displays a component when hovered
 over by a mouse on the client.
- Since:
- 4.0.0
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classHoverEvent.Action<V>An enumeration of hover event actions.static classHoverEvent.ShowEntityThe value of ashow_entityhover event.static classHoverEvent.ShowItemThe value of ashow_itemhover event.
- 
Method SummaryModifier and Type Method Description @NonNull HoverEvent.Action<V>action()Gets the hover event action.@NonNull HoverEvent<V>asHoverEvent()Represent this object as a hover event.@NonNull HoverEvent<V>asHoverEvent(@NonNull UnaryOperator<V> op)Creates a hover event with value derived from this object.booleanequals(@Nullable Object other)@NonNull Stream<? extends net.kyori.examination.ExaminableProperty>examinableProperties()inthashCode()static <V> @NonNull HoverEvent<V>hoverEvent(@NonNull HoverEvent.Action<V> action, @NonNull V value)Creates a hover event.static @NonNull HoverEvent<HoverEvent.ShowEntity>showEntity(@NonNull Key type, @NonNull UUID id)Creates a hover event that show information about an entity on hover.static @NonNull HoverEvent<HoverEvent.ShowEntity>showEntity(@NonNull Key type, @NonNull UUID id, @Nullable Component name)Creates a hover event that show information about an entity on hover.static @NonNull HoverEvent<HoverEvent.ShowEntity>showEntity(@NonNull HoverEvent.ShowEntity entity)Creates a hover event that show information about an entity on hover.static @NonNull HoverEvent<HoverEvent.ShowItem>showItem(@NonNull Key item, @org.checkerframework.checker.index.qual.NonNegative int count)Creates a hover event that shows an item on hover.static @NonNull HoverEvent<HoverEvent.ShowItem>showItem(@NonNull Key item, @org.checkerframework.checker.index.qual.NonNegative int count, @Nullable BinaryTagHolder nbt)Creates a hover event that shows an item on hover.static @NonNull HoverEvent<HoverEvent.ShowItem>showItem(@NonNull HoverEvent.ShowItem item)Creates a hover event that shows an item on hover.static @NonNull HoverEvent<Component>showText(@NonNull Component text)Creates a hover event that shows text on hover.static @NonNull HoverEvent<Component>showText(@NonNull ComponentLike text)Creates a hover event that shows text on hover.voidstyleApply(@NonNull Style.Builder style)Applies tostyle.StringtoString()@NonNull Vvalue()Gets the hover event value.@NonNull HoverEvent<V>value(@NonNull V value)Sets the hover event value.<C> @NonNull HoverEvent<V>withRenderedValue(@NonNull ComponentRenderer<C> renderer, @NonNull C context)Returns a hover event with the value rendered usingrendererwhen possible.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.kyori.adventure.text.format.StyleBuilderApplicablecomponentBuilderApply
- 
Method Details- 
showTextCreates a hover event that shows text on hover.- Parameters:
- text- the text to show on hover
- Returns:
- a hover event
- Since:
- 4.2.0
 
- 
showTextCreates a hover event that shows text on hover.- Parameters:
- text- the text to show on hover
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
showItempublic static @NonNull HoverEvent<HoverEvent.ShowItem> showItem(@NonNull Key item, @org.checkerframework.checker.index.qual.NonNegative int count)Creates a hover event that shows an item on hover.- Parameters:
- item- the item
- count- the count
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
showItempublic static @NonNull HoverEvent<HoverEvent.ShowItem> showItem(@NonNull Key item, @org.checkerframework.checker.index.qual.NonNegative int count, @Nullable BinaryTagHolder nbt)Creates a hover event that shows an item on hover.- Parameters:
- item- the item
- count- the count
- nbt- the nbt
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
showItemCreates a hover event that shows an item on hover.- Parameters:
- item- the item to show on hover
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
showEntitypublic static @NonNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NonNull Key type, @NonNull UUID id)Creates a hover event that show information about an entity on hover.- Parameters:
- type- the type
- id- the id
- Returns:
- a ShowEntity
- Since:
- 4.0.0
 
- 
showEntitypublic static @NonNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NonNull Key type, @NonNull UUID id, @Nullable Component name)Creates a hover event that show information about an entity on hover.- Parameters:
- type- the type
- id- the id
- name- the name
- Returns:
- a ShowEntity
- Since:
- 4.0.0
 
- 
showEntitypublic static @NonNull HoverEvent<HoverEvent.ShowEntity> showEntity(@NonNull HoverEvent.ShowEntity entity)Creates a hover event that show information about an entity on hover.- Parameters:
- entity- the entity to show on hover
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
hoverEventpublic static <V> @NonNull HoverEvent<V> hoverEvent(@NonNull HoverEvent.Action<V> action, @NonNull V value)Creates a hover event.- Type Parameters:
- V- the value type
- Parameters:
- action- the action
- value- the value
- Returns:
- a click event
- Since:
- 4.0.0
 
- 
actionGets the hover event action.- Returns:
- the hover event action
- Since:
- 4.0.0
 
- 
valueGets the hover event value.- Returns:
- the hover event value
- Since:
- 4.0.0
 
- 
valueSets the hover event value.- Parameters:
- value- the hover event value
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
withRenderedValuepublic <C> @NonNull HoverEvent<V> withRenderedValue(@NonNull ComponentRenderer<C> renderer, @NonNull C context)Returns a hover event with the value rendered usingrendererwhen possible.- Type Parameters:
- C- the context type
- Parameters:
- renderer- the renderer
- context- the render context
- Returns:
- a hover event
- Since:
- 4.0.0
 
- 
asHoverEventDescription copied from interface:HoverEventSourceRepresent this object as a hover event.- Specified by:
- asHoverEventin interface- HoverEventSource<V>
- Returns:
- a hover event
 
- 
asHoverEventDescription copied from interface:HoverEventSourceCreates a hover event with value derived from this object.The event value will be passed through the provided callback to allow transforming the original value of the event. - Specified by:
- asHoverEventin interface- HoverEventSource<V>
- Parameters:
- op- transformation on value
- Returns:
- a hover event
 
- 
styleApplyDescription copied from interface:StyleBuilderApplicableApplies tostyle.- Specified by:
- styleApplyin interface- StyleBuilderApplicable
- Parameters:
- style- the style builder
 
- 
equals
- 
hashCodepublic int hashCode()
- 
examinableProperties- Specified by:
- examinablePropertiesin interface- net.kyori.examination.Examinable
 
- 
toString
 
-