public class Layout extends Object
Constructor and Description |
---|
Layout(String name,
Function<Interaction,GroupComponent> templateTreeGenerator,
GuiSize size)
Instantiates a new Layout.
|
Modifier and Type | Method and Description |
---|---|
byte[][] |
getCachedRenderData(String state)
Get render data from cache if available null otherwise.
|
Interaction |
getDefaultInteraction()
Gets the default interaction.
|
String |
getName()
Gets name.
|
GuiSize |
getSize()
Gets size.
|
GroupComponent |
getTemplateComponentTree()
Gets component tree.
|
String |
processText(org.bukkit.entity.Player player,
Interaction interaction,
String text)
Applies the layout's text processors to the given text.
|
void |
registerTextProcessor(TextProcessor textProcessor)
Register a text processor.
|
byte[][] |
render(org.bukkit.entity.Player player,
Interaction interaction,
GuiPoint cursor,
String state)
Render this layout with the given parameters.
|
Interaction |
startNewInteraction()
Starts new interaction interaction for this GUI.
|
void |
syncExchange(GroupComponent componentTree,
List<Component> defaultHidden)
Replace current GUI with a new version on runtime.
|
void |
unregisterTextProcessor(TextProcessor textProcessor)
Unregister a text processor.
|
public Layout(String name, Function<Interaction,GroupComponent> templateTreeGenerator, GuiSize size)
name
- the nametemplateTreeGenerator
- the template tree generator is only called once with the defaultInteractionsize
- the sizepublic Interaction startNewInteraction()
public byte[][] render(org.bukkit.entity.Player player, Interaction interaction, GuiPoint cursor, String state)
player
- the playerinteraction
- the interactioncursor
- the cursorstate
- the statepublic byte[][] getCachedRenderData(String state)
state
- statepublic String processText(org.bukkit.entity.Player player, Interaction interaction, String text)
player
- the playerinteraction
- the interactiontext
- the textpublic void registerTextProcessor(TextProcessor textProcessor)
textProcessor
- the text processorpublic void unregisterTextProcessor(TextProcessor textProcessor)
textProcessor
- the text processorpublic GroupComponent getTemplateComponentTree()
public String getName()
public GuiSize getSize()
public Interaction getDefaultInteraction()
public void syncExchange(GroupComponent componentTree, List<Component> defaultHidden)
componentTree
- new component treedefaultHidden
- new components to be hidden by defaultCopyright © 2021. All rights reserved.