public abstract class BaseGui extends Object implements org.bukkit.inventory.InventoryHolder
| Constructor and Description |
|---|
BaseGui(@NotNull org.bukkit.plugin.Plugin plugin,
int rows,
@NotNull String title)
Main GUI constructor
|
BaseGui(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull String title)
GUI constructor with only title for easier 1 row GUIs
|
| Modifier and Type | Method and Description |
|---|---|
BaseGui |
addItem(GuiItem... items)
Adds items to the GUI without specific slot
|
BaseGui |
addSlotAction(int slot,
GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
Adds a Gui Action for when clicking on a specific slot
|
BaseGui |
addSlotAction(int row,
int col,
GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
Adds a Gui Action for when clicking on a specific slot with row and col instead
|
void |
close(@NotNull org.bukkit.entity.Player player)
Closes the gui
|
GuiFiller |
getFiller()
Return the GUI filler with the filling methods
|
GuiItem |
getGuiItem(int slot)
Gets a specific GuiItem on the slot
|
Map<Integer,GuiItem> |
getGuiItems()
Gets map with all the GUI items
|
@NotNull org.bukkit.inventory.Inventory |
getInventory()
Gets the main inventory holder
|
int |
getRows()
Gets the amount of rows
|
boolean |
isUpdating()
Checks weather or not the GUI is updating
|
void |
open(@NotNull org.bukkit.entity.HumanEntity player)
Opens the GUI for a player
|
BaseGui |
setCloseGuiAction(GuiAction<org.bukkit.event.inventory.InventoryCloseEvent> closeGuiAction)
Sets the action of what to do when GUI closes
|
BaseGui |
setDefaultClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultClickAction)
Sets the action of a default click on any item
|
BaseGui |
setDefaultTopClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultTopClickAction)
Sets the action of a default click on any item on the top part of the GUI
|
BaseGui |
setDragAction(GuiAction<org.bukkit.event.inventory.InventoryDragEvent> dragAction)
Sets the action of a default drag action
|
BaseGui |
setItem(int slot,
@NotNull GuiItem guiItem)
Add an item to the GUI
|
BaseGui |
setItem(int row,
int col,
@NotNull GuiItem guiItem)
Add an item to the GUI
|
BaseGui |
setItem(@NotNull List<Integer> slots,
@NotNull GuiItem guiItem)
Sets a GUI item to many slots
|
BaseGui |
setOpenGuiAction(GuiAction<org.bukkit.event.inventory.InventoryOpenEvent> openGuiAction)
Sets the action of what to do when GUI opens
|
BaseGui |
setOutsideClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> outsideClickAction)
Sets the action of when clicking on the outside of the inventory
|
BaseGui |
setRows(int rows)
Sets the number of rows the GUI should have
|
void |
setUpdating(boolean updating)
Sets the updating status of the GUI
|
void |
update()
Method to update the current opened GUI
|
void |
updateItem(int slot,
@NotNull GuiItem item)
Used for updating the current item in the GUI at runtime
|
void |
updateItem(int row,
int col,
@NotNull GuiItem item)
Used for updating the current item in the GUI at runtime
|
void |
updateItem(int row,
int col,
@NotNull org.bukkit.inventory.ItemStack itemStack)
Used for updating the current item in the GUI at runtime
|
void |
updateItem(int slot,
@NotNull org.bukkit.inventory.ItemStack itemStack)
Used for updating the current item in the GUI at runtime
|
BaseGui |
updateTitle(@NotNull String title)
Updates the title of the GUI
This method may cause LAG if used on a loop
|
public BaseGui(@NotNull
@NotNull org.bukkit.plugin.Plugin plugin,
int rows,
@NotNull
@NotNull String title)
plugin - The pluginrows - How many rows you wanttitle - The GUI's titlepublic BaseGui(@NotNull
@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull
@NotNull String title)
plugin - The plugintitle - The GUI's titlepublic BaseGui setRows(int rows)
rows - The number of rows to setpublic BaseGui setItem(int slot, @NotNull @NotNull GuiItem guiItem)
slot - The GUI slotguiItem - The GUI item to addpublic BaseGui setItem(@NotNull @NotNull List<Integer> slots, @NotNull @NotNull GuiItem guiItem)
slots - The slots in which the item should goguiItem - The Gui Item to addpublic BaseGui setItem(int row, int col, @NotNull @NotNull GuiItem guiItem)
row - The GUI row numbercol - The GUI col numberguiItem - The GUI item to addpublic BaseGui addItem(@NotNull GuiItem... items)
items - The Gui Itemspublic BaseGui setDefaultClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultClickAction)
defaultClickAction - Action to resolvepublic BaseGui setDefaultTopClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultTopClickAction)
defaultTopClickAction - Action to resolvepublic BaseGui setDragAction(GuiAction<org.bukkit.event.inventory.InventoryDragEvent> dragAction)
dragAction - Action to resolvepublic BaseGui setCloseGuiAction(GuiAction<org.bukkit.event.inventory.InventoryCloseEvent> closeGuiAction)
closeGuiAction - Action to resolvepublic BaseGui setOutsideClickAction(GuiAction<org.bukkit.event.inventory.InventoryClickEvent> outsideClickAction)
outsideClickAction - Action to resolvepublic BaseGui setOpenGuiAction(GuiAction<org.bukkit.event.inventory.InventoryOpenEvent> openGuiAction)
openGuiAction - Action to resolvepublic BaseGui addSlotAction(int slot, GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
slot - The slot to addslotAction - The gui actionpublic BaseGui addSlotAction(int row, int col, GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
row - The row of the slotcol - The col of the slotslotAction - The gui actionpublic GuiItem getGuiItem(int slot)
slot - The slot to getpublic boolean isUpdating()
public void setUpdating(boolean updating)
updating - Sets updatingpublic void open(@NotNull
@NotNull org.bukkit.entity.HumanEntity player)
player - The player to open it topublic void close(@NotNull
@NotNull org.bukkit.entity.Player player)
player - The player to close the GUI topublic void update()
public void updateItem(int slot,
@NotNull
@NotNull org.bukkit.inventory.ItemStack itemStack)
slot - The slot of the item to updateitemStack - The new ItemStackpublic void updateItem(int row,
int col,
@NotNull
@NotNull org.bukkit.inventory.ItemStack itemStack)
row - The row of the slotcol - The col of the slotitemStack - The new ItemStackpublic void updateItem(int slot,
@NotNull
@NotNull GuiItem item)
slot - The slot of the item to updateitem - The new ItemStackpublic void updateItem(int row,
int col,
@NotNull
@NotNull GuiItem item)
row - The row of the slotcol - The col of the slotitem - The new ItemStackpublic BaseGui updateTitle(@NotNull @NotNull String title)
title - The title to setpublic GuiFiller getFiller()
public Map<Integer,GuiItem> getGuiItems()
@NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()
getInventory in interface org.bukkit.inventory.InventoryHolderpublic int getRows()
Copyright © 2020. All rights reserved.