Package Kyu.GuiAPI_Redone.Window
Class Window
java.lang.Object
Kyu.GuiAPI_Redone.Window.Openable
Kyu.GuiAPI_Redone.Window.Window
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
- Direct Known Subclasses:
ChestWindow
-
Field Summary
Fields inherited from class Kyu.GuiAPI_Redone.Window.Openable
disableClickEvent, gui, isIgnoreCloseEvent, onClose, preventClose, unregisterOnClose -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aGuiItemto the Inventory, it will find the nearest free slot and place it therevoidClears the inventory of all itemsorg.bukkit.inventory.InventorygetItem(int slot) Get aGuiItemfrom a specific slotgetItems()protected intgetTitle()voidRefreshes the InventoryvoidremoveItem(int slot) Removes the item from the provided slotprotected abstract voidprotected voidsetInventory(org.bukkit.inventory.Inventory inv) voidSame asaddItem(GuiItem)but accepts a SlotMethods inherited from class Kyu.GuiAPI_Redone.Window.Openable
getGui, getOnClose, isDisableClickEvent, isIgnoreCloseEvent, isPreventClose, isUnregisterOnClose, open, setDisableClickEvent, setIgnoreCloseEvent, setOnClose, setPreventClose, setUnregisterOnClose
-
Constructor Details
-
Window
Creates a new window to be used in a gui- Parameters:
gui- TheGUIto usetitle- The title of the Window (will be color translated)
-
-
Method Details
-
clearItems
public void clearItems()Clears the inventory of all items -
addItem
Add aGuiItemto the Inventory, it will find the nearest free slot and place it there- Parameters:
item- The item to add
-
setItem
Same asaddItem(GuiItem)but accepts a SlotIf the slot is used, it will override the item
- Parameters:
item- The item to addslot- The slot to place it in- Throws:
SlotOufOfBoundsException- if the slot is less than 0 or greater than the inventory size
-
set
-
removeItem
public void removeItem(int slot) Removes the item from the provided slot- Parameters:
slot- Slot to remove the item from
-
getInventory
public org.bukkit.inventory.Inventory getInventory()- Specified by:
getInventoryin interfaceorg.bukkit.inventory.InventoryHolder- Returns:
- The inventory of the window that will be shown to the player when using
GUI.openWindow(Window)
-
getItems
- Returns:
- A list of
GuiItemplaced in the Inventory
-
getItem
Get aGuiItemfrom a specific slot- Parameters:
slot- the slot to get the item from- Returns:
- the GuiItem from that slot or Null if slot is empty
-
getTitle
- Returns:
- Title of the Window
-
refreshInventory
public void refreshInventory()Refreshes the Inventory -
setInventory
protected void setInventory(org.bukkit.inventory.Inventory inv) -
getNextFreeSlot
protected int getNextFreeSlot()
-