VitalPagedInventory
Defines a pageable inventory menu within the Vital-Framework. A pageable inventory can be used to display an inventory, whose content may extend to multiple inventory pages. Useful for creating "scrollable" content inside an inventory GUI, or a shop, selector, etc.
By default, the class will be a bean.
@VitalPagedInventory.Info(fromSlot = 0, toSlot = 9)
@VitalInventory.Info(type = VitalInventory.Type.GENERIC_9X1, name = "MyPagedInventory")
public class MyPagedInventory extends VitalPagedInventory {
@Override
public void onPageChange(int page, Player player) {
// This function is called when a specific player changes the page of his inventory.
}
// ...
}Types
Defines the info for a VitalPagedInventory. This annotation must be used on-top of VitalInventory.Info.
Properties
Functions
Gets all mapped actions for the given playerUniqueId. This function will never return null, even if the given playerUniqueId doesn't have this inventory open.
Gets the actual InventoryView for the given playerUniqueId. This function will return null if the given playerUniqueId doesn't have this inventory open.
Gets all items for the given playerUniqueId. This function will never return null, even if the given playerUniqueId doesn't have this inventory open.
Gets the current max page of the given playerUniqueId. This function will always at minimum return 1, even if the given player does not have this inventory open.
Gets the current page of the given playerUniqueId. This function will always at minimum return 1, even if the given player does not have this inventory open.
Gets the page content amount of this inventory defined by (Info.fromSlot + 1) - Info.toSlot.
Checks if the given SpigotPlayer currently has this inventory open.
Opens this inventory for the given player. Optionally, a previousInventory can be passed to make back-traversal possible.
Sets the given page for the given player. Additionally totalContent can be defined to automatically calculate the maxPages for the given player.
Updates this inventory for all players currently viewing it. Calling this function will call the onUpdate lifecycle function.
Updates this inventory for the given player and additionally calls the onPageChange lifecycle.
Updates the maximum number of pages based on the total amount of content.