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) int
void
open()
Calling directly can result inGUI
not 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 againvoid
openPage
(int index) Opens a specific Pagevoid
removeWindow
(int index) Removes aWindow
and closes the inventory if no more windows are presentvoid
removeWindow
(ChestWindow window) Removes aWindow
and closes the inventory if no more windows are presentvoid
setDisableClickEvent
(boolean disableClickEvent) Set whether or not InventoryClickEvent is canceled or not.void
setIgnoreCloseEvent
(boolean isIgnoreCloseEvent) void
setOnClose
(Consumer<org.bukkit.event.inventory.InventoryCloseEvent> onClose) void
setPreventClose
(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
- TheGUI
the MultiWindow is connected topaginationBar
- ThePaginationBar
to use
-
-
Method Details
-
open
public void open()Calling directly can result inGUI
not 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:
open
in classOpenable
- Throws:
MultiWindowEmptyException
- If the MultiWindow has not had anyWindow
s 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
Window
or null if no next window
-
getPreviousWindow
- Returns:
- The previous
Window
or null if no previous window
-
addWindow
- Parameters:
window
- TheWindow
to addindexArg
- Optional argument, the index of where to add the window- Returns:
- Throws:
NoPaginationPossibleException
- If the provided inventory has only 1 Row
-
removeWindow
Removes aWindow
and closes the inventory if no more windows are present- Parameters:
window
- The window to remove
-
removeWindow
public void removeWindow(int index) Removes aWindow
and closes the inventory if no more windows are present- Parameters:
index
- The index of the window to remove
-
getPaginationBar
- Returns:
- The
PaginationBar
for theWindow
s
-
getWindows
- Returns:
- The
Window
s in the MultiWindow
-
getCurrIndex
public int getCurrIndex()- Returns:
- The index of the currently opened
Window
-
setIgnoreCloseEvent
public void setIgnoreCloseEvent(boolean isIgnoreCloseEvent) - Overrides:
setIgnoreCloseEvent
in 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
WindowListener
not being unregistered on Inventory closed, so you will have to handle this manually
-
setOnClose
- Overrides:
setOnClose
in 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:
setPreventClose
in 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:
setDisableClickEvent
in classOpenable
- Parameters:
disableClickEvent
- Whether or not to cancel InventoryClickEvent
-