Class PagedInventoryImpl
- java.lang.Object
- 
- com.mrivanplays.pagedinventory.internal.PagedInventoryImpl
 
- 
- All Implemented Interfaces:
- PagedInventory
 
 public class PagedInventoryImpl extends Object implements PagedInventory 
- 
- 
Constructor SummaryConstructors Constructor Description PagedInventoryImpl()
 - 
Method SummaryAll Methods Instance Methods Concrete 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 thisPagedInventory@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- 
addOnClickFunctionpublic void addOnClickFunction(@NotNull @NotNull Consumer<PageClick> onClick)Description copied from interface:PagedInventoryAdds a click listener, when aPagegot clicked.- Specified by:
- addOnClickFunctionin interface- PagedInventory
- Parameters:
- onClick- on click function
 
 - 
addOnCloseFunctionpublic void addOnCloseFunction(@NotNull @NotNull Consumer<PageClose> onClose)Description copied from interface:PagedInventoryAdds a close listener, when aPagegot closed.- Specified by:
- addOnCloseFunctionin interface- PagedInventory
- Parameters:
- onClose- on close function
 
 - 
getPage@NotNull public @NotNull Optional<Page> getPage(int page) Description copied from interface:PagedInventoryRetrieves the page specified.- Specified by:
- getPagein interface- PagedInventory
- Parameters:
- page- the page you want to retrieve
- Returns:
- empty optional if page wasn't found, or else optional with value
 
 - 
getPage@NotNull public @NotNull Optional<Page> getPage(@NotNull @NotNull UUID page) Description copied from interface:PagedInventoryRetrieves the page by the specified page uuid- Specified by:
- getPagein interface- PagedInventory
- Parameters:
- page- page uuid
- Returns:
- empty optional if page wasn't found, or else optional with value
 
 - 
getPageNumber@NotNull public @NotNull OptionalInt getPageNumber(@NotNull @NotNull Page page) Description copied from interface:PagedInventoryRetrieves the page number of the page specified.- Specified by:
- getPageNumberin interface- PagedInventory
- Parameters:
- page- the page object you want to get numbe
- Returns:
- number of the page if present
 
 - 
getPageNumber@NotNull public @NotNull OptionalInt getPageNumber(@NotNull @NotNull UUID page) Description copied from interface:PagedInventoryRetrieves the page number of the page uuid specified- Specified by:
- getPageNumberin interface- PagedInventory
- Parameters:
- page- page uuid
- Returns:
- number of the page if present
 
 - 
addPagepublic void addPage(@NotNull @NotNull Page page)Description copied from interface:PagedInventoryAdds aPageto thisPagedInventory- Specified by:
- addPagein interface- PagedInventory
- Parameters:
- page- the page you want to add
 
 - 
setPagepublic void setPage(int pageNum, @NotNull @NotNull Page page)Description copied from interface:PagedInventory- Specified by:
- setPagein interface- PagedInventory
- Parameters:
- pageNum- the page number you want to override/set
- page- the page you want to set
 
 - 
removePagepublic void removePage(int page) Description copied from interface:PagedInventoryRemoves the specified page from thisPagedInventory- Specified by:
- removePagein interface- PagedInventory
- Parameters:
- page- the page you want to remove
 
 - 
getPages@NotNull public @NotNull Map<Integer,Page> getPages() Description copied from interface:PagedInventoryReturns a immutable map of thePagesthisPagedInventoryhas- Specified by:
- getPagesin interface- PagedInventory
- Returns:
- pages
 
 - 
setNavigationItempublic void setNavigationItem(int pos, @NotNull @NotNull NavigationItem item)Description copied from interface:PagedInventorySets the specifiedNavigationItemon the specifiedInventoryposition.- Specified by:
- setNavigationItemin interface- PagedInventory
- Parameters:
- pos- the inventory position you want the item on
- item- the navigation item you want to set
 
 - 
removeNavigationItempublic void removeNavigationItem(int pos) Description copied from interface:PagedInventoryRemoves the specifiedNavigationItemon that position.- Specified by:
- removeNavigationItemin interface- PagedInventory
- Parameters:
- pos- the position of the navigation item you want to remove
 
 - 
getNavigationItems@NotNull public @NotNull Map<Integer,NavigationItem> getNavigationItems() Description copied from interface:PagedInventoryReturns a immutable map of theNavigationItemsadded.- Specified by:
- getNavigationItemsin interface- PagedInventory
- Returns:
- navigation items
 
 - 
openpublic void open(@NotNull @NotNull org.bukkit.entity.Player viewer, int page)Description copied from interface:PagedInventoryOpens the specified page and adds thePlayerto the cache.- Specified by:
- openin interface- PagedInventory
- Parameters:
- viewer- viewer
- page- page
 
 - 
openPreviouspublic void openPrevious(@NotNull @NotNull org.bukkit.entity.Player viewer)Description copied from interface:PagedInventoryOpens the previous page of the page viewed by the player if present- Specified by:
- openPreviousin interface- PagedInventory
- Parameters:
- viewer- player viewer
 
 - 
openNextpublic void openNext(@NotNull @NotNull org.bukkit.entity.Player viewer)Description copied from interface:PagedInventoryOpens the next page of the page viewed by the player if present- Specified by:
- openNextin interface- PagedInventory
- Parameters:
- viewer- player viewer
 
 - 
getPageViewed@NotNull public @NotNull Optional<Page> getPageViewed(@NotNull @NotNull org.bukkit.entity.Player viewer) Description copied from interface:PagedInventoryReturns the page, currently viewed by the specifiedPlayerviewer- Specified by:
- getPageViewedin interface- PagedInventory
- Parameters:
- viewer- player viewer
- Returns:
- page viewed if present
 
 - 
getViewers@NotNull public @NotNull Map<UUID,UUID> getViewers() Description copied from interface:PagedInventoryReturns a immutable map of the known viewers and the viewed pages, key being aPlayer'sUUID, and value being aPage'sUUID- Specified by:
- getViewersin interface- PagedInventory
- Returns:
- viewers
 
 - 
getPagedInventoryUUID@NotNull public @NotNull UUID getPagedInventoryUUID() Description copied from interface:PagedInventoryReturns theUniqueIdof thisPagedInventory, in case you want to store it somewhere- Specified by:
- getPagedInventoryUUIDin interface- PagedInventory
- Returns:
- unique id
 
 
- 
 
-