Class MultiWindow
java.lang.Object
Kyu.GuiAPI_Redone.Window.Openable
Kyu.GuiAPI_Redone.Window.WindowImpl.MultiWindow.MultiWindow
-
Field Summary
Fields inherited from class Kyu.GuiAPI_Redone.Window.Openable
disableClickEvent, gui, isIgnoreCloseEvent, onClose, preventClose, unregisterOnClose -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddWindow(ChestWindow window, int... indexArg) intvoidopen()Calling directly can result inGUInot setting the current Window correctly! UseGUI.openWindow(Kyu.GuiAPI_Redone.Window.Openable)instead Opens the Window, either on index 0 if first open or the window it was previously on if opened againvoidopenPage(int index) Opens a specific PagevoidremoveWindow(int index) Removes aWindowand closes the inventory if no more windows are presentvoidremoveWindow(ChestWindow window) Removes aWindowand closes the inventory if no more windows are presentvoidsetDisableClickEvent(boolean disableClickEvent) Set whether or not InventoryClickEvent is canceled or not.voidsetIgnoreCloseEvent(boolean isIgnoreCloseEvent) voidsetOnClose(Consumer<org.bukkit.event.inventory.InventoryCloseEvent> onClose) voidsetPreventClose(boolean preventClose) Methods inherited from class Kyu.GuiAPI_Redone.Window.Openable
getGui, getOnClose, isDisableClickEvent, isIgnoreCloseEvent, isPreventClose, isUnregisterOnClose, setUnregisterOnClose
-
Constructor Details
-
MultiWindow
Creates a new MultiWindow- Parameters:
gui- TheGUIthe MultiWindow is connected topaginationBar- ThePaginationBarto use
-
-
Method Details
-
open
public void open()Calling directly can result inGUInot setting the current Window correctly! UseGUI.openWindow(Kyu.GuiAPI_Redone.Window.Openable)instead Opens the Window, either on index 0 if first open or the window it was previously on if opened again- Specified by:
openin classOpenable- Throws:
MultiWindowEmptyException- If the MultiWindow has not had anyWindows added yet
-
openPage
public void openPage(int index) Opens a specific Page- Parameters:
index- The index of the Page to open (starts at 0)- Throws:
NoSuchPageException- If the index is out of bounds
-
getNextWindow
- Returns:
- The next
Windowor null if no next window
-
getPreviousWindow
- Returns:
- The previous
Windowor null if no previous window
-
addWindow
- Parameters:
window- TheWindowto addindexArg- Optional argument, the index of where to add the window- Returns:
- Throws:
NoPaginationPossibleException- If the provided inventory has only 1 Row
-
removeWindow
Removes aWindowand closes the inventory if no more windows are present- Parameters:
window- The window to remove
-
removeWindow
public void removeWindow(int index) Removes aWindowand closes the inventory if no more windows are present- Parameters:
index- The index of the window to remove
-
getPaginationBar
- Returns:
- The
PaginationBarfor theWindows
-
getWindows
- Returns:
- The
Windows in the MultiWindow
-
getCurrIndex
public int getCurrIndex()- Returns:
- The index of the currently opened
Window
-
setIgnoreCloseEvent
public void setIgnoreCloseEvent(boolean isIgnoreCloseEvent) - Overrides:
setIgnoreCloseEventin classOpenable- Parameters:
isIgnoreCloseEvent- Whether or not the close Event will be ignored. If true, the onClose Consumer will not be calledDoes not do anything for the MultiWindow, but sets the flag for ALL WINDOWS contained in this MultiWindow Keep in mind that setting this to true will also result in the
WindowListenernot being unregistered on Inventory closed, so you will have to handle this manually
-
setOnClose
- Overrides:
setOnClosein classOpenable- Parameters:
onClose- Function to call when the inventory gets closed andOpenable.isIgnoreCloseEvent()is False. Automatically disablesOpenable.isPreventClose()Does not do anything for the MultiWindow, but sets the onClose Function for ALL WINDOWS container in this MultiWindow
-
setPreventClose
public void setPreventClose(boolean preventClose) - Overrides:
setPreventClosein classOpenable- Parameters:
preventClose- Whether or not the user shall be able to close the window with ESCDoes not do anything for the MultiWindow, but sets the flag for ALL WINDOWS contained in this MultiWindow
-
setDisableClickEvent
public void setDisableClickEvent(boolean disableClickEvent) Set whether or not InventoryClickEvent is canceled or not. Canceling prevents users from taking/placing items from the inventoryDoes not do anything for the MultiWindow, but sets the flag for ALL WINDOWS contained in this MultiWindow
- Overrides:
setDisableClickEventin classOpenable- Parameters:
disableClickEvent- Whether or not to cancel InventoryClickEvent
-