PaginatedGUI

class PaginatedGUI(player: Player) : InventoryGUI

A class that provides paginated inventory GUI functionality with improved item management. It allows dynamic page navigation, slot management, and customization using PersistentDataContainer.

Since

1.0.0

Author

RiriFa

Parameters

player

The player who will view the GUI.

See also

Constructors

Link copied to clipboard
constructor(player: Player)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Represents the list of buttons to be displayed in this inventory GUI. Each button corresponds to a slot and can define its own material, name, custom data, and click behavior.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds a single item to the existing item list.

Link copied to clipboard
open override fun build(): PaginatedGUI

Abstract method for building the inventory GUI. This method should be implemented by subclasses to define the layout and items of the GUI.

Link copied to clipboard
fun close()

Closes the inventory for the player.

Link copied to clipboard

Updates the inventory to display items for the current page.

Link copied to clipboard
open override fun getAllButtons(): List<Button>
Link copied to clipboard
fun getBackgroundMaterial(): Material?

Gets the background material set for the inventory GUI.

Link copied to clipboard
open override fun getInventory(): Inventory

Returns the inventory associated with this GUI.

Link copied to clipboard

Gets the current listener associated with this GUI.

Link copied to clipboard
fun getSize(): Int?

Gets the size of the inventory GUI.

Link copied to clipboard
fun getTitle(): Component?

Gets the title of this GUI.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun open()

Opens the inventory for the player.

Link copied to clipboard
Link copied to clipboard
fun setBackground(background: Material): InventoryGUI

Sets the background material for the inventory GUI.

Link copied to clipboard

Sets the number of items per page.

Link copied to clipboard

Sets a default button to display when there are no items.

Link copied to clipboard

Sets multiple items at once for the GUI. This replaces the existing item list.

Link copied to clipboard

Sets the listener for handling GUI events.

Link copied to clipboard

Sets the current page for the inventory.

Link copied to clipboard
fun setPageChangeButtons(prevButton: Button, nextButton: Button): PaginatedGUI

Sets the buttons for page navigation.

Link copied to clipboard

Sets the items to be paginated.

Link copied to clipboard
fun setShouldCallGlobalListener(shouldCallGlobalListener: Boolean): InventoryGUI

Sets whether the global listener should be called on inventory events.

Link copied to clipboard

Sets the size of the inventory GUI.

Link copied to clipboard

Sets the slot positions for items.

Link copied to clipboard
fun setTitle(title: Component): InventoryGUI

Sets the title of the inventory GUI.

Link copied to clipboard
fun setTotalPages(totalItems: Int): PaginatedGUI

Sets the total number of pages. This method should be called after setting up items.

Link copied to clipboard

Indicates whether the global listener should be called on inventory events.