public class PlaceholderTextComponent extends TextComponent implements org.bukkit.event.Listener
TextComponent that parses placeholders from the PlaceholderAPI.TextComponent.AlignmentalignmentclickAction, 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, setYgetClickAction, getId, getInteraction, isHidden, locate, locate, onClick, setClickAction, setHiddenpublic 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)
Componentapply in class TextComponentgraphic - the graphicplayer - 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())getState in class TextComponentplayer - the playercursor - the cursorpublic boolean isInBounds(org.bukkit.entity.Player player,
GuiPoint cursor)
ComponentisInBounds in class TextComponentplayer - the playercursor - the cursorpublic PlaceholderTextComponent clone(Interaction interaction)
Componentclone in class TextComponentinteraction - the interactionpublic PlaceholderTextComponent locateOn(Interaction interaction)
Componentinteraction.getComponentTree().locate(component.getId())locateOn in class TextComponentinteraction - the interactionprotected String getText(org.bukkit.entity.Player player)
getText in class TextComponentprotected Rectangle2D getBounds(org.bukkit.entity.Player player)
getBounds in class TextComponentpublic void dispose()
Componentpublic void onQuit(org.bukkit.event.player.PlayerQuitEvent event)
Copyright © 2021. All rights reserved.