public abstract class Pane extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Pane.Priority
An enum representing the rendering priorities for the panes.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
height
Length is horizontal, height is vertical
|
protected int |
length
Length is horizontal, height is vertical
|
protected Consumer<org.bukkit.event.inventory.InventoryClickEvent> |
onClick
The consumer that will be called once a players clicks in the gui
|
protected int |
x
The starting position of this pane, which is 0 by default
|
protected int |
y
The starting position of this pane, which is 0 by default
|
| Modifier | Constructor and Description |
|---|---|
protected |
Pane(int length,
int height)
Constructs a new default pane, with no position
|
protected |
Pane(int x,
int y,
int length,
int height)
Constructs a new default pane
|
protected |
Pane(int x,
int y,
int length,
int height,
Pane.Priority priority)
Constructs a new default pane
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Clears the entire pane of any items/panes.
|
abstract boolean |
click(Gui gui,
org.bukkit.event.inventory.InventoryClickEvent event,
int paneOffsetX,
int paneOffsetY,
int maxLength,
int maxHeight)
Called whenever there is being clicked on this pane
|
abstract void |
display(Gui gui,
org.bukkit.inventory.Inventory inventory,
org.bukkit.inventory.PlayerInventory playerInventory,
int paneOffsetX,
int paneOffsetY,
int maxLength,
int maxHeight)
Has to set all the items in the right spot inside the inventory
|
int |
getHeight()
Returns the height of this pane
|
abstract Collection<GuiItem> |
getItems()
Gets all the items in this pane and all underlying panes
|
int |
getLength()
Returns the length of this pane
|
abstract Collection<Pane> |
getPanes()
Gets all the panes in this panes, including any child panes from other panes
|
Pane.Priority |
getPriority()
Returns the priority of the pane
|
static Map<String,Function<String,Object>> |
getPropertyMappings()
Returns the property mappings used when loading properties from an XML file.
|
int |
getX()
Gets the x coordinate of this pane
|
int |
getY()
Gets the y coordinate of this pane
|
boolean |
isVisible()
Returns the pane's visibility state
|
static void |
load(Pane pane,
Object instance,
Element element) |
static GuiItem |
loadItem(Object instance,
Element element)
Loads an item from an instance and an element
|
void |
setHeight(int height)
Set the height of this pane
|
void |
setLength(int length)
Set the length of this pane
|
void |
setOnClick(Consumer<org.bukkit.event.inventory.InventoryClickEvent> onClick)
Set the consumer that should be called whenever this gui is clicked in.
|
void |
setOnLocalClick(Consumer<org.bukkit.event.inventory.InventoryClickEvent> onLocalClick)
Deprecated.
|
void |
setPriority(Pane.Priority priority)
Sets the priority of this pane
|
void |
setVisible(boolean visible)
Sets whether this pane is visible or not
|
void |
setX(int x)
Set the x coordinate of this pane
|
void |
setY(int y)
Set the y coordinate of this pane
|
protected int x
protected int y
protected int length
protected int height
@Nullable protected Consumer<org.bukkit.event.inventory.InventoryClickEvent> onClick
protected Pane(int x,
int y,
int length,
int height,
@NotNull
Pane.Priority priority)
x - the upper left x coordinate of the paney - the upper left y coordinate of the panelength - the length of the paneheight - the height of the panepriority - the priority of the paneprotected Pane(int length,
int height)
length - the length of the paneheight - the height of the paneprotected Pane(int x,
int y,
int length,
int height)
x - the upper left x coordinate of the paney - the upper left y coordinate of the panelength - the length of the paneheight - the height of the panepublic void setLength(int length)
length - the new lengthpublic void setHeight(int height)
height - the new heightpublic void setX(int x)
x - the new x coordinatepublic void setY(int y)
y - the new y coordinate@Contract(pure=true) public int getLength()
@Contract(pure=true) public int getHeight()
@Contract(pure=true) public int getX()
@Contract(pure=true) public int getY()
public abstract void display(@NotNull
Gui gui,
@NotNull
org.bukkit.inventory.Inventory inventory,
@NotNull
org.bukkit.inventory.PlayerInventory playerInventory,
int paneOffsetX,
int paneOffsetY,
int maxLength,
int maxHeight)
gui - the gui for which we're renderinginventory - the inventory that the items should be displayed inplayerInventory - the player's inventorypaneOffsetX - the pane's offset on the x axispaneOffsetY - the pane's offset on the y axismaxLength - the maximum length of the panemaxHeight - the maximum height of the pane@Contract(pure=true) public boolean isVisible()
public void setVisible(boolean visible)
visible - the pane's visibilitypublic abstract boolean click(@NotNull
Gui gui,
@NotNull
org.bukkit.event.inventory.InventoryClickEvent event,
int paneOffsetX,
int paneOffsetY,
int maxLength,
int maxHeight)
gui - the gui this event stems fromevent - the event that occurred while clicking on this itempaneOffsetX - the pane's offset on the x axispaneOffsetY - the pane's offset on the y axismaxLength - the maximum length of the panemaxHeight - the maximum height of the panepublic void setPriority(@NotNull
Pane.Priority priority)
priority - the priority@NotNull @Contract(pure=true) public static GuiItem loadItem(@NotNull Object instance, @NotNull Element element)
instance - the instanceelement - the elementpublic static void load(@NotNull
Pane pane,
@NotNull
Object instance,
@NotNull
Element element)
@NotNull public Pane.Priority getPriority()
@NotNull @Contract(pure=true) public abstract Collection<GuiItem> getItems()
@NotNull @Contract(pure=true) public abstract Collection<Pane> getPanes()
public abstract void clear()
public void setOnClick(@Nullable
Consumer<org.bukkit.event.inventory.InventoryClickEvent> onClick)
onClick - the consumer that gets called@Deprecated public void setOnLocalClick(@Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> onLocalClick)
setOnClick(Consumer)onLocalClick - the consumer that gets calledCopyright © 2019. All rights reserved.