Interface Window

All Superinterfaces:
GUIParent
All Known Implementing Classes:
AnvilSplitWindow, AnvilWindow, BaseWindow, CartographySplitWindow, CartographyWindow, CombinedWindow, MergedWindow, SimpleCombinedWindow, SimpleSplitWindow, SimpleWindow, SingleWindow, SplitWindow

public interface Window extends GUIParent
A window is the way to show a player a GUI. Windows can only have one viewer.
See Also:
  • Method Details

    • getInventories

      org.bukkit.inventory.Inventory[] getInventories()
      Gets the underlying Inventorys.
      Returns:
      The underlying Inventorys.
    • getGuis

      GUI[] getGuis()
      Gets the underlying GUIs.
      Returns:
      The underlying GUIs.
    • handleClick

      void handleClick(org.bukkit.event.inventory.InventoryClickEvent event)
      A method called by the WindowManager to notify the Window that one of its Items has been clicked.
      Parameters:
      event - The InventoryClickEvent associated with this action.
    • handleDrag

      void handleDrag(org.bukkit.event.inventory.InventoryDragEvent event)
      A method called by the WindowManager to notify the Window that ItemStacks have been dragged inside it.
      Parameters:
      event - The InventoryDragEvent associated with this action.
    • handleItemShift

      void handleItemShift(org.bukkit.event.inventory.InventoryClickEvent event)
      A method called by the WindowManager to notify the Window that ItemStacks have been shift-clicked from the lower Inventory to this Window
      Parameters:
      event - The InventoryClickEvent associated with this action.
    • handleCursorCollect

      void handleCursorCollect(org.bukkit.event.inventory.InventoryClickEvent event)
      A method called by the WindowManager to notify the Window that a Player is trying to collect ItemStack to the cursor by double-clicking in the player inventory. This method is not called when the player inventory is also part of the Window. (MergedWindow)
      Parameters:
      event - The InventoryClickEvent associated with this action.
    • handleOpen

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

      void handleClose(org.bukkit.entity.Player player)
      A method called by the WindowManager to notify the Window that its underlying Inventory is being closed.
      Parameters:
      player - The Player who closed this inventory.
    • handleViewerDeath

      void handleViewerDeath(org.bukkit.event.entity.PlayerDeathEvent event)
      A method called by the WindowManager to notify the Window that it's viewer has died.
      Parameters:
      event - The PlayerDeathEvent associated with this action.
    • handleItemProviderUpdate

      void handleItemProviderUpdate(Item item)
      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.
      Parameters:
      item - The Item whose ItemProvider has been updated.
    • handleVirtualInventoryUpdate

      void handleVirtualInventoryUpdate(VirtualInventory virtualInventory)
      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.
      Parameters:
      virtualInventory - The VirtualInventory
    • addCloseHandler

      void addCloseHandler(Runnable closeHandler)
      Adds a close handler that will be called when this window gets closed.
      Parameters:
      closeHandler - The close handler to add
    • removeCloseHandler

      void removeCloseHandler(Runnable closeHandler)
      Removes a close handler that has been added previously.
      Parameters:
      closeHandler - The close handler to remove
    • close

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

      boolean isClosed()
      Gets if the Window is closed and can't be shown again.
      Returns:
      If the Window is closed.
    • closeForViewer

      void closeForViewer()
      Closes the underlying Inventory for its viewer.
    • show

      void show()
      Shows the window to the player.
    • isCloseable

      boolean isCloseable()
      Gets if the player is able to close the Inventory.
      Returns:
      If the player is able to close the Inventory.
    • setCloseable

      void setCloseable(boolean closeable)
      Sets if the player should be able to close the Inventory.
      Parameters:
      closeable - If the player should be able to close the Inventory.
    • changeTitle

      void changeTitle(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent[] title)
      Changes the title of the Inventory.
      Parameters:
      title - The new title
    • changeTitle

      void changeTitle(@NotNull @NotNull String title)
      Changes the title of the Inventory.
      Parameters:
      title - The new title
    • getViewer

      org.bukkit.entity.Player getViewer()
      Gets the viewer of this Window
      Returns:
      The viewer of this window.
    • getCurrentViewer

      org.bukkit.entity.Player getCurrentViewer()
      Gets the current Player that is viewing this Window or null of there isn't one.
      Returns:
      The current viewer of this Window (can be null)
    • getViewerUUID

      UUID getViewerUUID()
      Gets the viewer's UUID
      Returns:
      The viewer's UUID