Interface PagedInventory

  • All Known Implementing Classes:
    PagedInventoryImpl

    public interface PagedInventory
    Represents a paged inventory
    • Method Detail

      • addOnClickFunction

        void addOnClickFunction​(@NotNull
                                @NotNull Consumer<PageClick> onClick)
        Adds a click listener, when a Page got clicked.
        Parameters:
        onClick - on click function
      • addOnCloseFunction

        void addOnCloseFunction​(@NotNull
                                @NotNull Consumer<PageClose> onClose)
        Adds a close listener, when a Page got closed.
        Parameters:
        onClose - on close function
      • getPage

        @NotNull
        @NotNull Optional<Page> getPage​(int page)
        Retrieves the page specified.
        Parameters:
        page - the page you want to retrieve
        Returns:
        empty optional if page wasn't found, or else optional with value
      • getPage

        @NotNull
        @NotNull Optional<Page> getPage​(@NotNull
                                        @NotNull UUID page)
        Retrieves the page by the specified page uuid
        Parameters:
        page - page uuid
        Returns:
        empty optional if page wasn't found, or else optional with value
      • getPageNumber

        @NotNull
        @NotNull OptionalInt getPageNumber​(@NotNull
                                           @NotNull Page page)
        Retrieves the page number of the page specified.
        Parameters:
        page - the page object you want to get numbe
        Returns:
        number of the page if present
      • getPageNumber

        @NotNull
        @NotNull OptionalInt getPageNumber​(@NotNull
                                           @NotNull UUID page)
        Retrieves the page number of the page uuid specified
        Parameters:
        page - page uuid
        Returns:
        number of the page if present
      • addPage

        void addPage​(@NotNull
                     @NotNull Page page)
        Adds a Page to this PagedInventory
        Parameters:
        page - the page you want to add
      • setPage

        void setPage​(int pageNum,
                     @NotNull
                     @NotNull Page page)
        Sets the specified Page number to the specified Page in this PagedInventory
        Parameters:
        pageNum - the page number you want to override/set
        page - the page you want to set
      • removePage

        void removePage​(int page)
        Removes the specified page from this PagedInventory
        Parameters:
        page - the page you want to remove
      • setNavigationItem

        void setNavigationItem​(int pos,
                               @NotNull
                               @NotNull NavigationItem item)
        Sets the specified NavigationItem on the specified Inventory position.
        Parameters:
        pos - the inventory position you want the item on
        item - the navigation item you want to set
      • removeNavigationItem

        void removeNavigationItem​(int pos)
        Removes the specified NavigationItem on that position.
        Parameters:
        pos - the position of the navigation item you want to remove
      • open

        void open​(@NotNull
                  @NotNull org.bukkit.entity.Player viewer,
                  int page)
        Opens the specified page and adds the Player to the cache.
        Parameters:
        viewer - viewer
        page - page
      • openPrevious

        void openPrevious​(@NotNull
                          @NotNull org.bukkit.entity.Player viewer)
        Opens the previous page of the page viewed by the player if present
        Parameters:
        viewer - player viewer
      • openNext

        void openNext​(@NotNull
                      @NotNull org.bukkit.entity.Player viewer)
        Opens the next page of the page viewed by the player if present
        Parameters:
        viewer - player viewer
      • getPageViewed

        @NotNull
        @NotNull Optional<Page> getPageViewed​(@NotNull
                                              @NotNull org.bukkit.entity.Player viewer)
        Returns the page, currently viewed by the specified Player viewer
        Parameters:
        viewer - player viewer
        Returns:
        page viewed if present
      • getViewers

        @NotNull
        @NotNull Map<UUID,​UUID> getViewers()
        Returns a immutable map of the known viewers and the viewed pages, key being a Player's UUID, and value being a Page's UUID
        Returns:
        viewers
      • getPagedInventoryUUID

        @NotNull
        @NotNull UUID getPagedInventoryUUID()
        Returns the UniqueId of this PagedInventory, in case you want to store it somewhere
        Returns:
        unique id