public class GroupComponent extends Component
clickAction, hidden, id, interaction
Constructor and Description |
---|
GroupComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
List<Component> components)
Instantiates a new GroupComponent.
|
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.
|
GroupComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
static GroupComponent |
createEmpty(Interaction interaction)
Create empty group component which can be used whenever a component is needed that renders nothing.
|
List<Component> |
getComponents()
Gets all components in a mutable list.
|
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.
|
GroupComponent |
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.
|
dispose, getClickAction, getId, getInteraction, isHidden, locate, setClickAction, setHidden
public GroupComponent(String id, Action clickAction, boolean hidden, Interaction interaction, List<Component> components)
id
- the component idclickAction
- the click actionshidden
- the hiddeninteraction
- the interactioncomponents
- the componentspublic static GroupComponent createEmpty(Interaction interaction)
interaction
- the interactionpublic void onClick(org.bukkit.entity.Player player, GuiPoint cursor, boolean isPrimary)
Component
public 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 Component locate(String componentId)
Component
public GroupComponent clone(Interaction interaction)
Component
public GroupComponent locateOn(Interaction interaction)
Component
interaction.getComponentTree().locate(component.getId())
Copyright © 2021. All rights reserved.