clickAction, hidden, id, interaction
Constructor and Description |
---|
HoverDetectorComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
Action onHoverEnter,
Action onHoverExit,
Component child)
Instantiates a new HoverDetectorComponent
|
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.
|
HoverDetectorComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
Component |
getChild()
Gets child component.
|
Action |
getOnHoverEnter()
Gets on hover enter action.
|
Action |
getOnHoverExit()
Gets on hover exit action.
|
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.
|
HoverDetectorComponent |
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 |
setChild(Component child)
Sets child component.
|
void |
setOnHoverEnter(Action onHoverEnter)
Sets on hover enter action.
|
void |
setOnHoverExit(Action onHoverExit)
Sets on hover exit action.
|
dispose, getClickAction, getId, getInteraction, isHidden, locate, locate, setClickAction, setHidden
public HoverDetectorComponent(String id, Action clickAction, boolean hidden, Interaction interaction, Action onHoverEnter, Action onHoverExit, Component child)
id
- the idclickAction
- the click actionhidden
- the hiddeninteraction
- the interactiononHoverEnter
- the on hover enteronHoverExit
- the on hover exitchild
- the childpublic void apply(Graphics graphic, org.bukkit.entity.Player player, GuiPoint cursor)
Component
public boolean isInBounds(org.bukkit.entity.Player player, GuiPoint cursor)
Component
isInBounds
in class Component
player
- the playercursor
- the cursorpublic String getState(org.bukkit.entity.Player player, GuiPoint cursor)
Component
Component.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 HoverDetectorComponent clone(Interaction interaction)
Component
public HoverDetectorComponent locateOn(Interaction interaction)
Component
interaction.getComponentTree().locate(component.getId())
public void onClick(org.bukkit.entity.Player player, GuiPoint cursor, boolean isPrimary)
Component
public Action getOnHoverEnter()
public void setOnHoverEnter(Action onHoverEnter)
onHoverEnter
- the on hover enterpublic Action getOnHoverExit()
public void setOnHoverExit(Action onHoverExit)
onHoverExit
- the on hover exitpublic Component getChild()
public void setChild(Component child)
child
- the childCopyright © 2021. All rights reserved.