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.设置 GUI 内容。重写此方法以添加自定义内容。
- 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).获取当前页码(从 1 开始)。
- 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)
-