public class PaginatedPane extends Pane
Pane.Priority| Constructor and Description |
|---|
PaginatedPane(int length,
int height) |
PaginatedPane(int x,
int y,
int length,
int height) |
PaginatedPane(int x,
int y,
int length,
int height,
Pane.Priority priority) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPane(int page,
Pane pane)
Assigns a pane to a selected page
|
void |
clear()
Clears the entire pane of any items/panes.
|
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
|
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
|
Collection<GuiItem> |
getItems()
Gets all the items in this pane and all underlying panes
|
int |
getPage()
Returns the current page
|
int |
getPages()
Returns the amount of pages
|
Collection<Pane> |
getPanes()
Gets all the panes in this panes, including any child panes from other panes
|
static PaginatedPane |
load(Object instance,
Element element)
Loads a paginated pane from a given element
|
void |
populateWithGuiItems(List<GuiItem> items)
Populates the PaginatedPane based on the provided list by adding new pages until all items can fit.
|
void |
populateWithItemStacks(List<org.bukkit.inventory.ItemStack> items)
Populates the PaginatedPane based on the provided list by adding new pages until all items can fit.
|
void |
populateWithNames(List<String> displayNames,
org.bukkit.Material material)
This method creates a list of ItemStacks all with the given
material and the display names. |
void |
setPage(int page)
Sets the current displayed page
|
getHeight, getLength, getPriority, getPropertyMappings, getX, getY, isVisible, load, loadItem, setHeight, setLength, setOnClick, setOnLocalClick, setPriority, setVisible, setX, setYpublic PaginatedPane(int x,
int y,
int length,
int height,
@NotNull
Pane.Priority priority)
public PaginatedPane(int x,
int y,
int length,
int height)
public PaginatedPane(int length,
int height)
public int getPage()
public int getPages()
public void addPane(int page,
@NotNull
Pane pane)
page - the page to assign the pane topane - the new panepublic void setPage(int page)
page - the page@Contract(value="null -> fail")
public void populateWithItemStacks(@NotNull
List<org.bukkit.inventory.ItemStack> items)
items - The list to populate the pane with@Contract(value="null -> fail")
public void populateWithGuiItems(@NotNull
List<GuiItem> items)
items - The list to populate the pane with@Contract(value="null, _ -> fail")
public void populateWithNames(@NotNull
List<String> displayNames,
@Nullable
org.bukkit.Material material)
material and the display names.
After that it calls populateWithItemStacks(List)
This method also translates the color char & for all names.displayNames - The display names for all the itemsmaterial - The material to use for the ItemStackspublic 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)
display in class Panegui - 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 panepublic boolean click(@NotNull
Gui gui,
@NotNull
org.bukkit.event.inventory.InventoryClickEvent event,
int paneOffsetX,
int paneOffsetY,
int maxLength,
int maxHeight)
click in class Panegui - 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 pane@NotNull @Contract(pure=true) public Collection<Pane> getPanes()
@NotNull @Contract(pure=true) public Collection<GuiItem> getItems()
public void clear()
@NotNull @Contract(value="_, null -> fail") public static PaginatedPane load(@NotNull Object instance, @NotNull Element element)
instance - the instance classelement - the elementCopyright © 2019. All rights reserved.