Class PaginatedMenu<T>
java.lang.Object
com.github.pinont.singularitylib.api.ui.Menu
com.github.pinont.singularitylib.api.ui.PaginatedMenu<T>
- Type Parameters:
T- the element type
A paginated inventory menu over a list of items of type
T.
Renders pageSize entries per page into the given content slots,
with automatic Prev/Next buttons and a page indicator. This is the
foundation for every list-style view (e.g. DevTool v2's plugin lists,
world lists, player lists).
-
Constructor Summary
ConstructorsConstructorDescriptionPaginatedMenu(org.bukkit.plugin.Plugin plugin, String title, int size, int pageSize, int[] contentSlots, List<T> items, Function<T, org.bukkit.inventory.ItemStack> itemRenderer, BiConsumer<org.bukkit.entity.Player, T> onClick) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddExtraBottomRowInto(List<Button> buttons) Hook: subclasses add bottom-row buttons here (they are merged before rendering).intintgetPage()voidshow(org.bukkit.entity.Player player) Shows this menu to the specified player.voidshowPage(org.bukkit.entity.Player player, int targetPage) Jumps to a specific page and re-renders the inventory for the player.protected voidupdateItems(List<T> items, Function<T, org.bukkit.inventory.ItemStack> renderer, BiConsumer<org.bukkit.entity.Player, T> click) Re-points the data this menu pages over (used by subclasses that re-render, e.g.Methods inherited from class Menu
addButton, clearButtons, getButtons, getLayout, getPlugin, getSize, getTitle, setKey, setLayout
-
Constructor Details
-
PaginatedMenu
public PaginatedMenu(org.bukkit.plugin.Plugin plugin, String title, int size, int pageSize, int[] contentSlots, List<T> items, Function<T, org.bukkit.inventory.ItemStack> itemRenderer, BiConsumer<org.bukkit.entity.Player, T> onClick) - Parameters:
plugin- the owning plugintitle- menu titlesize- inventory size (multiple of 9)pageSize- entries per pagecontentSlots- which slots hold content (e.g. slots 9..35)items- the full item listitemRenderer- maps an element to its ItemStackonClick- invoked when a content item is clicked
-
-
Method Details
-
updateItems
-
showPage
public void showPage(org.bukkit.entity.Player player, int targetPage) Jumps to a specific page and re-renders the inventory for the player. -
getPage
public int getPage() -
getMaxPage
public int getMaxPage() -
show
-
addExtraBottomRowInto
-