Class BaseWindow

java.lang.Object
de.studiocode.invui.window.impl.BaseWindow
All Implemented Interfaces:
GUIParent, Window
Direct Known Subclasses:
MergedWindow, SingleWindow

public abstract class BaseWindow extends Object implements Window
  • Constructor Details

    • BaseWindow

      public BaseWindow(UUID viewerUUID, net.md_5.bungee.api.chat.BaseComponent[] title, int size, boolean closeable, boolean removeOnClose)
  • Method Details

    • register

      protected void register()
    • redrawItem

      protected void redrawItem(int index)
    • redrawItem

      protected void redrawItem(int index, SlotElement element, boolean setItem)
    • handleDrag

      public void handleDrag(org.bukkit.event.inventory.InventoryDragEvent event)
      Description copied from interface: Window
      A method called by the WindowManager to notify the Window that ItemStacks have been dragged inside it.
      Specified by:
      handleDrag in interface Window
      Parameters:
      event - The InventoryDragEvent associated with this action.
    • handleOpen

      public void handleOpen(org.bukkit.event.inventory.InventoryOpenEvent event)
      Description copied from interface: Window
      A method called by the WindowManager to notify the Window that its underlying Inventory is being opened.
      Specified by:
      handleOpen in interface Window
      Parameters:
      event - The InventoryOpenEvent associated with this action.
    • handleClose

      public void handleClose(org.bukkit.entity.Player player)
      Description copied from interface: Window
      A method called by the WindowManager to notify the Window that its underlying Inventory is being closed.
      Specified by:
      handleClose in interface Window
      Parameters:
      player - The Player who closed this inventory.
    • handleItemProviderUpdate

      public void handleItemProviderUpdate(Item item)
      Description copied from interface: Window
      A method called by the Item itself to notify the Window that its ItemProvider has been updated and the ItemStack in the Inventory should be replaced.
      Specified by:
      handleItemProviderUpdate in interface Window
      Parameters:
      item - The Item whose ItemProvider has been updated.
    • handleVirtualInventoryUpdate

      public void handleVirtualInventoryUpdate(VirtualInventory virtualInventory)
      Description copied from interface: Window
      A method called by the VirtualInventory to notify the Window that one if it's contents has been updated and the ItemStack's displayed in the Inventory should be replaced.
      Specified by:
      handleVirtualInventoryUpdate in interface Window
      Parameters:
      virtualInventory - The VirtualInventory
    • getItemSlotElements

      protected Map<Integer,SlotElement> getItemSlotElements(Item item)
    • getVISlotElements

      protected Map<Integer,SlotElement> getVISlotElements(VirtualInventory virtualInventory)
    • close

      public void close(boolean closeForViewer)
      Description copied from interface: Window
      Removes the Window from the WindowManager list. If this method is called, the Window can't be shown again.
      Specified by:
      close in interface Window
      Parameters:
      closeForViewer - If the underlying Inventory should be closed for the viewer.
    • closeForViewer

      public void closeForViewer()
      Description copied from interface: Window
      Closes the underlying Inventory for its viewer.
      Specified by:
      closeForViewer in interface Window
    • show

      public void show()
      Description copied from interface: Window
      Shows the window to the player.
      Specified by:
      show in interface Window
    • changeTitle

      public void changeTitle(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent[] title)
      Description copied from interface: Window
      Changes the title of the Inventory.
      Specified by:
      changeTitle in interface Window
      Parameters:
      title - The new title
    • changeTitle

      public void changeTitle(@NotNull @NotNull String title)
      Description copied from interface: Window
      Changes the title of the Inventory.
      Specified by:
      changeTitle in interface Window
      Parameters:
      title - The new title
    • addCloseHandler

      public void addCloseHandler(Runnable closeHandler)
      Description copied from interface: Window
      Adds a close handler that will be called when this window gets closed.
      Specified by:
      addCloseHandler in interface Window
      Parameters:
      closeHandler - The close handler to add
    • removeCloseHandler

      public void removeCloseHandler(Runnable closeHandler)
      Description copied from interface: Window
      Removes a close handler that has been added previously.
      Specified by:
      removeCloseHandler in interface Window
      Parameters:
      closeHandler - The close handler to remove
    • getCurrentViewer

      public org.bukkit.entity.Player getCurrentViewer()
      Description copied from interface: Window
      Gets the current Player that is viewing this Window or null of there isn't one.
      Specified by:
      getCurrentViewer in interface Window
      Returns:
      The current viewer of this Window (can be null)
    • getViewer

      public org.bukkit.entity.Player getViewer()
      Description copied from interface: Window
      Gets the viewer of this Window
      Specified by:
      getViewer in interface Window
      Returns:
      The viewer of this window.
    • getViewerUUID

      public UUID getViewerUUID()
      Description copied from interface: Window
      Gets the viewer's UUID
      Specified by:
      getViewerUUID in interface Window
      Returns:
      The viewer's UUID
    • isCloseable

      public boolean isCloseable()
      Description copied from interface: Window
      Gets if the player is able to close the Inventory.
      Specified by:
      isCloseable in interface Window
      Returns:
      If the player is able to close the Inventory.
    • setCloseable

      public void setCloseable(boolean closeable)
      Description copied from interface: Window
      Sets if the player should be able to close the Inventory.
      Specified by:
      setCloseable in interface Window
      Parameters:
      closeable - If the player should be able to close the Inventory.
    • isClosed

      public boolean isClosed()
      Description copied from interface: Window
      Gets if the Window is closed and can't be shown again.
      Specified by:
      isClosed in interface Window
      Returns:
      If the Window is closed.
    • setInvItem

      protected abstract void setInvItem(int slot, org.bukkit.inventory.ItemStack itemStack)
    • getSlotElement

      protected abstract SlotElement getSlotElement(int index)
    • getGuiAt

      protected abstract Pair<GUI,Integer> getGuiAt(int index)
    • handleOpened

      protected abstract void handleOpened()
    • handleClosed

      protected abstract void handleClosed()