java.lang.Object
Kyu.GuiAPI_Redone.Window.Openable
Kyu.GuiAPI_Redone.Window.WindowImpl.MultiWindow.MultiWindow

public abstract class MultiWindow extends Openable
  • Constructor Details

    • MultiWindow

      public MultiWindow(GUI gui, PaginationBar paginationBar)
      Creates a new MultiWindow
      Parameters:
      gui - The GUI the MultiWindow is connected to
      paginationBar - The PaginationBar to use
  • Method Details

    • open

      public void open()
      Calling directly can result in GUI not setting the current Window correctly! Use GUI.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 class Openable
      Throws:
      MultiWindowEmptyException - If the MultiWindow has not had any Windows 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

      public Window getNextWindow()
      Returns:
      The next Window or null if no next window
    • getPreviousWindow

      public Window getPreviousWindow()
      Returns:
      The previous Window or null if no previous window
    • addWindow

      public MultiWindow addWindow(ChestWindow window, int... indexArg)
      Parameters:
      window - The Window to add
      indexArg - Optional argument, the index of where to add the window
      Returns:
      Throws:
      NoPaginationPossibleException - If the provided inventory has only 1 Row
    • removeWindow

      public void removeWindow(ChestWindow window)
      Removes a Window and closes the inventory if no more windows are present
      Parameters:
      window - The window to remove
    • removeWindow

      public void removeWindow(int index)
      Removes a Window and closes the inventory if no more windows are present
      Parameters:
      index - The index of the window to remove
    • getPaginationBar

      public PaginationBar getPaginationBar()
      Returns:
      The PaginationBar for the Windows
    • getWindows

      public List<ChestWindow> 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:
      setIgnoreCloseEvent in class Openable
      Parameters:
      isIgnoreCloseEvent - Whether or not the close Event will be ignored. If true, the onClose Consumer will not be called

      Does 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

      public void setOnClose(Consumer<org.bukkit.event.inventory.InventoryCloseEvent> onClose)
      Overrides:
      setOnClose in class Openable
      Parameters:
      onClose - Function to call when the inventory gets closed and Openable.isIgnoreCloseEvent() is False. Automatically disables Openable.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 class Openable
      Parameters:
      preventClose - Whether or not the user shall be able to close the window with ESC

      Does 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 inventory

      Does not do anything for the MultiWindow, but sets the flag for ALL WINDOWS contained in this MultiWindow

      Overrides:
      setDisableClickEvent in class Openable
      Parameters:
      disableClickEvent - Whether or not to cancel InventoryClickEvent