Interface PagedInventory
-
- All Known Implementing Classes:
PagedInventoryImpl
public interface PagedInventoryRepresents a paged inventory
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddOnClickFunction(@NotNull Consumer<PageClick> onClick)Adds a click listener, when aPagegot clicked.voidaddOnCloseFunction(@NotNull Consumer<PageClose> onClose)Adds a close listener, when aPagegot closed.voidaddPage(@NotNull Page page)Adds aPageto thisPagedInventorystatic PagedInventoryBuilderbuilder(@NotNull org.bukkit.plugin.Plugin plugin)Creates a new builder for a paged inventory.@NotNull Map<Integer,NavigationItem>getNavigationItems()Returns a immutable map of theNavigationItemsadded.@NotNull Optional<Page>getPage(int page)Retrieves the page specified.@NotNull Optional<Page>getPage(@NotNull UUID page)Retrieves the page by the specified page uuid@NotNull UUIDgetPagedInventoryUUID()Returns theUniqueIdof thisPagedInventory, in case you want to store it somewhere@NotNull OptionalIntgetPageNumber(@NotNull Page page)Retrieves the page number of the page specified.@NotNull OptionalIntgetPageNumber(@NotNull UUID page)Retrieves the page number of the page uuid specified@NotNull Map<Integer,Page>getPages()Returns a immutable map of thePagesthisPagedInventoryhas@NotNull Optional<Page>getPageViewed(@NotNull org.bukkit.entity.Player viewer)Returns the page, currently viewed by the specifiedPlayerviewer@NotNull Map<UUID,UUID>getViewers()voidopen(@NotNull org.bukkit.entity.Player viewer, int page)Opens the specified page and adds thePlayerto the cache.voidopenNext(@NotNull org.bukkit.entity.Player viewer)Opens the next page of the page viewed by the player if presentvoidopenPrevious(@NotNull org.bukkit.entity.Player viewer)Opens the previous page of the page viewed by the player if presentvoidremoveNavigationItem(int pos)Removes the specifiedNavigationItemon that position.voidremovePage(int page)Removes the specified page from thisPagedInventoryvoidsetNavigationItem(int pos, @NotNull NavigationItem item)Sets the specifiedNavigationItemon the specifiedInventoryposition.voidsetPage(int pageNum, @NotNull Page page)
-
-
-
Method Detail
-
builder
static PagedInventoryBuilder builder(@NotNull @NotNull org.bukkit.plugin.Plugin plugin)
Creates a new builder for a paged inventory.
This is just a shortcut toPagedInventoryBuilder.createBuilder(Plugin)- Parameters:
plugin- plugin owning- Returns:
- builder
-
addOnClickFunction
void addOnClickFunction(@NotNull @NotNull Consumer<PageClick> onClick)Adds a click listener, when aPagegot clicked.- Parameters:
onClick- on click function
-
addOnCloseFunction
void addOnCloseFunction(@NotNull @NotNull Consumer<PageClose> onClose)Adds a close listener, when aPagegot 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 aPageto thisPagedInventory- Parameters:
page- the page you want to add
-
setPage
void setPage(int pageNum, @NotNull @NotNull Page page)- Parameters:
pageNum- the page number you want to override/setpage- the page you want to set
-
removePage
void removePage(int page)
Removes the specified page from thisPagedInventory- Parameters:
page- the page you want to remove
-
getPages
@NotNull @NotNull Map<Integer,Page> getPages()
Returns a immutable map of thePagesthisPagedInventoryhas- Returns:
- pages
-
setNavigationItem
void setNavigationItem(int pos, @NotNull @NotNull NavigationItem item)Sets the specifiedNavigationItemon the specifiedInventoryposition.- Parameters:
pos- the inventory position you want the item onitem- the navigation item you want to set
-
removeNavigationItem
void removeNavigationItem(int pos)
Removes the specifiedNavigationItemon that position.- Parameters:
pos- the position of the navigation item you want to remove
-
getNavigationItems
@NotNull @NotNull Map<Integer,NavigationItem> getNavigationItems()
Returns a immutable map of theNavigationItemsadded.- Returns:
- navigation items
-
open
void open(@NotNull @NotNull org.bukkit.entity.Player viewer, int page)Opens the specified page and adds thePlayerto the cache.- Parameters:
viewer- viewerpage- 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 specifiedPlayerviewer- 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 aPlayer'sUUID, and value being aPage'sUUID- Returns:
- viewers
-
getPagedInventoryUUID
@NotNull @NotNull UUID getPagedInventoryUUID()
Returns theUniqueIdof thisPagedInventory, in case you want to store it somewhere- Returns:
- unique id
-
-