public class DummyComponent extends Component
clickAction, hidden, id, interaction| Constructor and Description |
|---|
DummyComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction)
Instantiates a new DummyComponent.
|
| 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.
|
DummyComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
void |
dispose()
Dispose the component.
|
Component |
getComponent()
Gets the component that the dummy component acts as
|
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.
|
DummyComponent |
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 |
setClickAction(Action clickAction)
Sets the click action.
|
void |
setComponent(Component component)
Sets this dummy component to act as the provided component.
|
getClickAction, getId, getInteraction, isHidden, locate, setHiddenpublic DummyComponent(String id, Action clickAction, boolean hidden, Interaction interaction)
id - the components id (should be unique)clickAction - the click actionhidden - the hiddeninteraction - the interactionpublic Component getComponent()
public void setComponent(Component component)
component - the componentpublic 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 DummyComponent clone(Interaction interaction)
Componentpublic DummyComponent locateOn(Interaction interaction)
Componentinteraction.getComponentTree().locate(component.getId())public void onClick(org.bukkit.entity.Player player,
GuiPoint cursor,
boolean isPrimary)
Componentpublic void dispose()
Componentpublic void setClickAction(Action clickAction)
ComponentsetClickAction in class ComponentclickAction - the click actionCopyright © 2021. All rights reserved.