Interface Window

All Known Subinterfaces:
AnvilWindow, CartographyWindow
All Known Implementing Classes:
AbstractDoubleWindow, AbstractMergedWindow, AbstractSingleWindow, AbstractSplitWindow, AbstractWindow

public interface Window
A Window is the way to show a player a Gui. Windows can only have one viewer. To create a new Window, use the builder factory methods single(), split() and merged().
See Also:
  • Method Details Link icon

    • single Link icon

      @NotNull static Window.Builder.Normal.Single single()
      Creates a new Window Builder for a normal single window.
      Returns:
      The new Window Builder.
    • single Link icon

      @NotNull static @NotNull Window single(@NotNull @NotNull Consumer<@NotNull Window.Builder.Normal.Single> consumer)
      Creates a new normal single Window after configuring a Window Builder with the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Window Builder.
      Returns:
      The new Window.
    • split Link icon

      @NotNull static Window.Builder.Normal.Split split()
      Creates a new Window Builder for a normal split window.
      Returns:
      The new Window Builder.
    • split Link icon

      @NotNull static @NotNull Window split(@NotNull @NotNull Consumer<@NotNull Window.Builder.Normal.Split> consumer)
      Creates a new normal split Window after configuring a Window Builder with the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Window Builder.
      Returns:
      The new Window.
    • merged Link icon

      @NotNull static Window.Builder.Normal.Merged merged()
      Creates a new Window Builder for a normal merged window.
      Returns:
      The new Window Builder.
    • merged Link icon

      @NotNull static @NotNull Window merged(@NotNull @NotNull Consumer<@NotNull Window.Builder.Normal.Merged> consumer)
      Creates a new normal merged Window after configuring a Window Builder with the given Consumer.
      Parameters:
      consumer - The Consumer to configure the Window Builder.
      Returns:
      The new Window.
    • open Link icon

      void open()
      Shows the window to the player.
    • isCloseable Link icon

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

      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.
    • close Link icon

      void close()
      Closes the underlying Inventory for its viewer.
    • isOpen Link icon

      boolean isOpen()
      Gets if the viewer is currently viewing this Window.
      Returns:
      If the Window is currently open.
    • changeTitle Link icon

      void changeTitle(@NotNull @NotNull xyz.xenondevs.inventoryaccess.component.ComponentWrapper title)
      Changes the title of the Inventory.
      Parameters:
      title - The new title
    • changeTitle Link icon

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

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

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

      @Nullable @Nullable 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 Link icon

      @NotNull @NotNull UUID getViewerUUID()
      Gets the viewer's UUID
      Returns:
      The viewer's UUID
    • getPlayerItems Link icon

      @Nullable @Nullable org.bukkit.inventory.ItemStack @Nullable [] getPlayerItems()
      Gets the contents of the viewer's inventory. This method will always return the actual inventory contents and will not be affected by double windows placing gui items in the Player's inventory.
      Returns:
      The contents of the viewer's inventory, or null if the Window isn't open.
    • setOpenHandlers Link icon

      void setOpenHandlers(@Nullable @Nullable List<@NotNull Runnable> openHandlers)
      Replaces the currently registered open handlers with the given list.
      Parameters:
      openHandlers - The new open handlers
    • addOpenHandler Link icon

      void addOpenHandler(@NotNull @NotNull Runnable openHandler)
      Adds an open handler that will be called when this window gets opened.
      Parameters:
      openHandler - The close handler to add
    • setCloseHandlers Link icon

      void setCloseHandlers(@Nullable @Nullable List<@NotNull Runnable> closeHandlers)
      Replaces the currently registered close handlers with the given list.
      Parameters:
      closeHandlers - The new close handlers
    • addCloseHandler Link icon

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

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

      void setOutsideClickHandlers(@Nullable @Nullable List<@NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent>> outsideClickHandlers)
      Replaces the currently registered outside click handlers with the given list.
      Parameters:
      outsideClickHandlers - The new outside click handlers
    • addOutsideClickHandler Link icon

      void addOutsideClickHandler(@NotNull @NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent> outsideClickHandler)
      Adds an outside click handler that will be called when a player clicks outside the inventory.
      Parameters:
      outsideClickHandler - The outside click handler to add
    • removeOutsideClickHandler Link icon

      void removeOutsideClickHandler(@NotNull @NotNull Consumer<@NotNull org.bukkit.event.inventory.InventoryClickEvent> outsideClickHandler)
      Removes an outside click handler that has been added previously.
      Parameters:
      outsideClickHandler - The outside click handler to remove