public class HoverComponent extends Component
clickAction, hidden, id, interaction| Constructor and Description |
|---|
HoverComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
@NotNull Component normal,
@NotNull Component hovered)
Instantiates a new HoverComponent.
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply(Graphics graphic,
org.bukkit.entity.Player player,
GuiPoint cursor)
Render the component on the provided graphic context.
|
HoverComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
Component |
getHovered()
Gets the hovered component.
|
Component |
getNormal()
Gets the normal component.
|
String |
getState(org.bukkit.entity.Player player,
GuiPoint cursor)
Gets the current state of the component for the given parameters.
|
boolean |
isInBounds(org.bukkit.entity.Player player,
GuiPoint cursor)
Checks whether the cursor is in bounds of the component.
|
Component |
locate(String componentId)
Locate the component with the given id.
|
HoverComponent |
locateOn(Interaction interaction)
Locate the same component on a different interaction.
|
void |
onClick(org.bukkit.entity.Player player,
GuiPoint cursor,
boolean isPrimary)
Called when a player clicks on the component.
|
void |
setHovered(Component hovered)
Sets the hovered component.
|
void |
setNormal(Component normal)
Sets the normal component.
|
dispose, getClickAction, getId, getInteraction, isHidden, locate, setClickAction, setHiddenpublic HoverComponent(String id, Action clickAction, boolean hidden, Interaction interaction, @NotNull @NotNull Component normal, @NotNull @NotNull Component hovered)
id - the component idclickAction - the click actionshidden - the hiddeninteraction - the interactionnormal - the normalhovered - the hoveredpublic void apply(Graphics graphic, org.bukkit.entity.Player player, GuiPoint cursor)
Componentpublic boolean isInBounds(org.bukkit.entity.Player player,
GuiPoint cursor)
ComponentisInBounds in class Componentplayer - the playercursor - the cursorpublic String getState(org.bukkit.entity.Player player, GuiPoint cursor)
ComponentComponent.apply(Graphics, Player, GuiPoint) renders different content, then the this method should
return different strings. If it renders the same the return value should be the same.
RectComponent returns
x+"*"+y+"*"+width+"*"+height+"*"+color.getRGB())public Component locate(String componentId)
Componentpublic HoverComponent clone(Interaction interaction)
Componentpublic HoverComponent locateOn(Interaction interaction)
Componentinteraction.getComponentTree().locate(component.getId())public void onClick(org.bukkit.entity.Player player,
GuiPoint cursor,
boolean isPrimary)
Componentpublic Component getNormal()
public void setNormal(Component normal)
normal - the normal componentpublic Component getHovered()
public void setHovered(Component hovered)
hovered - the hovered componentCopyright © 2021. All rights reserved.