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 TypeMethodDescriptionvoid
Add aGuiItem
to the Inventory, it will find the nearest free slot and place it therevoid
Clears the inventory of all itemsorg.bukkit.inventory.Inventory
getItem
(int slot) Get aGuiItem
from a specific slotgetItems()
protected int
getTitle()
void
Refreshes the Inventoryvoid
removeItem
(int slot) Removes the item from the provided slotprotected abstract void
protected void
setInventory
(org.bukkit.inventory.Inventory inv) void
Same 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
- TheGUI
to usetitle
- The title of the Window (will be color translated)
-
-
Method Details
-
clearItems
public void clearItems()Clears the inventory of all items -
addItem
Add aGuiItem
to 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:
getInventory
in 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
GuiItem
placed in the Inventory
-
getItem
Get aGuiItem
from 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()
-