Class InventoryGUIHelper
java.lang.Object
org.mvplugins.multiverse.inventories.view.InventoryGUIHelper
A helper class for creating and validating items within the custom inventory GUIs.
This centralizes logic for filler items and slot-specific item validation.
- Since:
- 5.2
-
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStack
createFillerItem
(org.bukkit.Material material, String name, String lore) Creates a generic filler item for GUI slots.org.bukkit.inventory.ItemStack
createFillerItemForSlot
(int slot, boolean isModifiable) Creates the appropriate filler item for a given special slot in the custom GUI.boolean
isDisplayItem
(org.bukkit.inventory.ItemStack item) Checks if a given ItemStack is a general display item created by this helper.boolean
isFillerItem
(org.bukkit.inventory.ItemStack item) Checks if a given ItemStack is a filler item created by this helper.boolean
isValidItemForSlot
(org.bukkit.inventory.ItemStack item, int slot) Determines if an ItemStack is valid for a given special inventory slot in the custom GUI.void
populateInventoryGUI
(org.bukkit.inventory.Inventory inv, PlayerInventoryData playerInventoryData, boolean isModifiable) Populates the given custom inventory GUI with player inventory data and appropriate filler items.
-
Method Details
-
createFillerItem
@AvailableSince("5.2") public org.bukkit.inventory.ItemStack createFillerItem(org.bukkit.Material material, String name, String lore) Creates a generic filler item for GUI slots.- Parameters:
material
- The material of the filler item.name
- The display name of the item.lore
- The lore text for the item.- Returns:
- The created ItemStack.
- Since:
- 5.2
-
isFillerItem
@AvailableSince("5.2") public boolean isFillerItem(@NotNull org.bukkit.inventory.ItemStack item) Checks if a given ItemStack is a filler item created by this helper.- Parameters:
item
- The ItemStack to check.- Returns:
- True if the item is a filler, false otherwise.
- Since:
- 5.2
-
isDisplayItem
@AvailableSince("5.2") public boolean isDisplayItem(@NotNull org.bukkit.inventory.ItemStack item) Checks if a given ItemStack is a general display item created by this helper.- Parameters:
item
- The ItemStack to check.- Returns:
- True if the item is a display item, false otherwise.
- Since:
- 5.2
-
isValidItemForSlot
@AvailableSince("5.2") public boolean isValidItemForSlot(@NotNull org.bukkit.inventory.ItemStack item, int slot) Determines if an ItemStack is valid for a given special inventory slot in the custom GUI. This method is used for both armor and off-hand slot validation.- Parameters:
item
- The ItemStack to check.slot
- The raw slot number (36-40 for armor/off-hand).- Returns:
- True if the item is valid for the slot, false otherwise.
- Since:
- 5.2
-
createFillerItemForSlot
@AvailableSince("5.2") public org.bukkit.inventory.ItemStack createFillerItemForSlot(int slot, boolean isModifiable) Creates the appropriate filler item for a given special slot in the custom GUI.- Parameters:
slot
- The raw slot number (36-40).- Returns:
- The specific filler ItemStack for that slot.
- Since:
- 5.2
-
populateInventoryGUI
@AvailableSince("5.2") public void populateInventoryGUI(@NotNull org.bukkit.inventory.Inventory inv, @NotNull PlayerInventoryData playerInventoryData, boolean isModifiable) Populates the given custom inventory GUI with player inventory data and appropriate filler items.- Parameters:
inv
- The Inventory GUI to populate.playerInventoryData
- The data containing player's contents, armor, and off-hand.isModifiable
- True if the inventory is modifiable, false for read-only.- Since:
- 5.2
-