public class GifComponent extends Component implements org.bukkit.event.Listener
clickAction, hidden, id, interaction
Constructor and Description |
---|
GifComponent(String id,
Action clickAction,
boolean hidden,
Interaction interaction,
int x,
int y,
GifFrame[] gifFrames,
boolean pausedByDefault)
Instantiates a new GifComponent.
|
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.
|
GifComponent |
clone(Interaction interaction)
Clone the component with the new interaction.
|
GifFrame[] |
getGifFrames()
Get gif frames
|
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.
|
GifComponent |
locateOn(Interaction interaction)
Locate the same component on a different interaction.
|
void |
setFrame(int frame)
Sets which frame is currently shown for a certain interaction
|
void |
setGifFrames(GifFrame[] gifFrames)
Sets the GIF.
|
void |
setPaused(boolean paused)
Sets whether the GIF is paused for a certain interaction
|
dispose, getClickAction, getId, getInteraction, isHidden, locate, locate, onClick, setClickAction, setHidden
public GifComponent(String id, Action clickAction, boolean hidden, Interaction interaction, int x, int y, GifFrame[] gifFrames, boolean pausedByDefault)
id
- the component idclickAction
- the click actionshidden
- the hiddeninteraction
- the interactionx
- the xy
- the ygifFrames
- the gif framespausedByDefault
- the paused by defaultpublic 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 GifComponent clone(Interaction interaction)
Component
public GifComponent locateOn(Interaction interaction)
Component
interaction.getComponentTree().locate(component.getId())
public GifFrame[] getGifFrames()
public void setPaused(boolean paused)
paused
- pausedpublic void setFrame(int frame)
frame
- the framepublic void setGifFrames(GifFrame[] gifFrames)
gifFrames
- the imageCopyright © 2021. All rights reserved.