public class PlaceholderTextComponent extends TextComponent implements org.bukkit.event.Listener
TextComponent
that parses placeholders from the PlaceholderAPI.TextComponent.Alignment
alignment
clickAction, hidden, id, interaction
Constructor and Description |
---|
PlaceholderTextComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
int x,
int y,
Font font,
String text,
Color color,
TextComponent.Alignment alignment)
Instantiates a new PlaceholderText component.
|
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.
|
PlaceholderTextComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
void |
dispose()
Dispose the component.
|
protected Rectangle2D |
getBounds(org.bukkit.entity.Player player) |
String |
getState(org.bukkit.entity.Player player,
GuiPoint cursor)
Gets the current state of the component for the given parameters.
|
protected String |
getText(org.bukkit.entity.Player player) |
boolean |
isInBounds(org.bukkit.entity.Player player,
GuiPoint cursor)
Checks whether the cursor is in bounds of the component.
|
PlaceholderTextComponent |
locateOn(Interaction interaction)
Locate the same component on a different interaction.
|
void |
onQuit(org.bukkit.event.player.PlayerQuitEvent event) |
copyWith, getColor, getFont, getText, getX, getY, setColor, setFont, setText, setX, setY
getClickAction, getId, getInteraction, isHidden, locate, locate, onClick, setClickAction, setHidden
public PlaceholderTextComponent(String id, Action clickAction, boolean hidden, Interaction interaction, int x, int y, Font font, String text, Color color, TextComponent.Alignment alignment)
id
- the component idclickAction
- the click actionshidden
- the hiddeninteraction
- the interactionx
- the xy
- the yfont
- the fonttext
- the textcolor
- the coloralignment
- the alignmentpublic void apply(Graphics graphic, org.bukkit.entity.Player player, GuiPoint cursor)
Component
apply
in class TextComponent
graphic
- the graphicplayer
- 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()
)getState
in class TextComponent
player
- the playercursor
- the cursorpublic boolean isInBounds(org.bukkit.entity.Player player, GuiPoint cursor)
Component
isInBounds
in class TextComponent
player
- the playercursor
- the cursorpublic PlaceholderTextComponent clone(Interaction interaction)
Component
clone
in class TextComponent
interaction
- the interactionpublic PlaceholderTextComponent locateOn(Interaction interaction)
Component
interaction.getComponentTree().locate(component.getId())
locateOn
in class TextComponent
interaction
- the interactionprotected String getText(org.bukkit.entity.Player player)
getText
in class TextComponent
protected Rectangle2D getBounds(org.bukkit.entity.Player player)
getBounds
in class TextComponent
public void dispose()
Component
public void onQuit(org.bukkit.event.player.PlayerQuitEvent event)
Copyright © 2021. All rights reserved.