public class TextInputComponent extends Component
Modifier and Type | Field and Description |
---|---|
static String |
ID_PLACEHOLDER_SUFFIX
The constant ID_PLACEHOLDER_SUFFIX.
|
static String |
ID_TEXT_SUFFIX
The constant ID_TEXT_SUFFIX.
|
clickAction, hidden, id, interaction
Constructor and Description |
---|
TextInputComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
int x,
int y,
int width,
int height,
int padding,
Color backgroundColor,
Color backgroundColorActive,
Font font,
Color fontColor,
Color fontColorPlaceholder,
String placeHolder,
@NotNull String defaultInput,
InputHandler inputHandler,
boolean registerPlaceholder)
Instantiates a new TextInputComponent.
|
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.
|
TextInputComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
void |
dispose()
Dispose the component.
|
String |
getInput()
Get current input for an interaction.
|
String |
getRawInput()
Get current raw input for an interaction.
|
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.
|
TextInputComponent |
locateOn(Interaction interaction)
Locate the same component on a different interaction.
|
void |
onChat(org.bukkit.event.player.AsyncPlayerChatEvent event) |
void |
setInput(String input,
boolean involveInputHandler)
Sets input for an interaction.
|
void |
setInputHandler(InputHandler inputHandler)
Sets input handler.
|
getClickAction, getId, getInteraction, isHidden, locate, locate, onClick, setClickAction, setHidden
public static final String ID_TEXT_SUFFIX
public static final String ID_PLACEHOLDER_SUFFIX
public TextInputComponent(String id, Action clickAction, boolean hidden, Interaction interaction, int x, int y, int width, int height, int padding, Color backgroundColor, Color backgroundColorActive, Font font, Color fontColor, Color fontColorPlaceholder, String placeHolder, @NotNull @NotNull String defaultInput, InputHandler inputHandler, boolean registerPlaceholder)
id
- the idclickAction
- the click actionhidden
- the hiddeninteraction
- the interactionx
- the xy
- the ywidth
- the widthheight
- the heightpadding
- the paddingbackgroundColor
- the background colorbackgroundColorActive
- the background color activefont
- the fontfontColor
- the font colorfontColorPlaceholder
- the font color placeholderplaceHolder
- the place holderdefaultInput
- the default inputinputHandler
- whether to register a PAPI placeholderregisterPlaceholder
- whether to register a PAPI placeholderpublic void setInputHandler(InputHandler inputHandler)
inputHandler
- the input handlerpublic 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 TextInputComponent clone(Interaction interaction)
Component
public TextInputComponent locateOn(Interaction interaction)
Component
interaction.getComponentTree().locate(component.getId())
public void dispose()
Component
public void setInput(String input, boolean involveInputHandler)
input
- the inputinvolveInputHandler
- whether to involve input handlerpublic String getInput()
public String getRawInput()
public void onChat(org.bukkit.event.player.AsyncPlayerChatEvent event)
Copyright © 2021. All rights reserved.