Class BasePaginationPage
java.lang.Object
mc.obliviate.inventory.Gui
com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
com.ultikits.ultitools.abstracts.gui.BasePaginationPage
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
Base class for paginated inventory pages.
Provides automatic pagination with next/previous buttons.
- Since:
- 6.2.0
- Version:
- 2.0.0
- Author:
- wisdomme
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDefault column for the "next" button (0-based)private final mc.obliviate.inventory.pagination.PaginationManagerprotected static final intDefault column for the "previous" button (0-based)Fields inherited from class com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
DEFAULT_BOTTOM_ROWFields inherited from class mc.obliviate.inventory.Gui
player -
Constructor Summary
ConstructorsConstructorDescriptionBasePaginationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, String title, int rows) BasePaginationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, String title, org.bukkit.event.inventory.InventoryType inventoryType) BasePaginationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, net.kyori.adventure.text.Component title, int rows) BasePaginationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, net.kyori.adventure.text.Component title, org.bukkit.event.inventory.InventoryType inventoryType) -
Method Summary
Modifier and TypeMethodDescriptionprotected mc.obliviate.inventory.IconCreates the "next page" button.protected mc.obliviate.inventory.IconCreates the "previous page" button.intGets the current page number (1-based).protected mc.obliviate.inventory.pagination.PaginationManagerGets the pagination manager.intGets the total number of pages.voidgoToPage(int page) Goes to a specific page.booleanChecks if there are more pages after the current one.booleanChecks if there are pages before the current one.private voidInitializes the pagination manager.protected abstract List<mc.obliviate.inventory.Icon> Provides the items for pagination.protected final voidsetupContent(org.bukkit.event.inventory.InventoryOpenEvent event) Sets up the GUI content.protected voidSets up the navigation buttons.protected voidUpdates the paginated content.Methods inherited from class com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
addToBottomRow, afterSetup, createActionButton, createBackgroundIcon, fillArea, fillBorder, getBottomCenterSlot, getContentSlots, getSlotFromEnd, onClose, onClose, onOpen, refresh, setShowBottomToolbar, setupBottomToolbarMethods inherited from class mc.obliviate.inventory.Gui
addItem, addItem, addItem, addItem, addItem, addItem, addItem, addItem, createInventory, createInventory, fillColumn, fillGui, fillGui, fillGui, fillGui, fillRow, getId, getInventory, getItems, getLastSlot, getPlugin, getSize, getTaskList, getTitle, isClosed, onClick, onDrag, open, runTaskLater, sendSizeUpdate, sendTitleUpdate, setClosed, setInventory, setSize, setTitle, stopAllTasks, stopTask, updateTask
-
Field Details
-
paginationManager
private final mc.obliviate.inventory.pagination.PaginationManager paginationManager -
PREV_BUTTON_COLUMN
protected static final int PREV_BUTTON_COLUMNDefault column for the "previous" button (0-based)- See Also:
-
NEXT_BUTTON_COLUMN
protected static final int NEXT_BUTTON_COLUMNDefault column for the "next" button (0-based)- See Also:
-
-
Constructor Details
-
BasePaginationPage
-
BasePaginationPage
-
BasePaginationPage
public BasePaginationPage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, net.kyori.adventure.text.Component title, int rows) -
BasePaginationPage
public BasePaginationPage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, net.kyori.adventure.text.Component title, org.bukkit.event.inventory.InventoryType inventoryType)
-
-
Method Details
-
initPagination
private void initPagination()Initializes the pagination manager. -
setupContent
protected final void setupContent(org.bukkit.event.inventory.InventoryOpenEvent event) Description copied from class:BaseInventoryPageSets up the GUI content. Override this method to add custom content.- Specified by:
setupContentin classBaseInventoryPage- Parameters:
event- the inventory open event
-
updatePaginatedContent
protected void updatePaginatedContent()Updates the paginated content. -
createPreviousButton
protected mc.obliviate.inventory.Icon createPreviousButton()Creates the "previous page" button. Override to customize.- Returns:
- the previous button icon
-
createNextButton
protected mc.obliviate.inventory.Icon createNextButton()Creates the "next page" button. Override to customize.- Returns:
- the next button icon
-
provideItems
Provides the items for pagination. Override this method to provide the items to display.- Returns:
- list of icons to paginate
-
getPaginationManager
protected mc.obliviate.inventory.pagination.PaginationManager getPaginationManager()Gets the pagination manager.- Returns:
- the pagination manager
-
getCurrentPage
public int getCurrentPage()Gets the current page number (1-based).- Returns:
- the current page number
-
getTotalPages
public int getTotalPages()Gets the total number of pages.- Returns:
- the total page count
-
hasNextPage
public boolean hasNextPage()Checks if there are more pages after the current one.- Returns:
- true if not on the last page
-
hasPreviousPage
public boolean hasPreviousPage()Checks if there are pages before the current one.- Returns:
- true if not on the first page
-
goToPage
public void goToPage(int page) Goes to a specific page.- Parameters:
page- the page number (1-based)
-