MenuItemStack is a utility class in zMenu that allows you to define and reuse item representations (name, lore, material, etc.) from configuration files.
In this guide, you'll learn how to load and build MenuItemStack objects.
Step 1: Load a MenuItemStack
There are two ways to load a MenuItemStack using the InventoryManager.
From a YamlConfiguration
Copy MenuItemStack itemStack = inventoryManager . loadItemStack (configuration , "path.to.item" , file); configuration: A YamlConfiguration instance
"path.to.item": Path to the section in the YAML
file: The file source (for error tracking)
From a Map (programmatic)
Copy MenuItemStack itemStack = inventoryManager . loadItemStack (file , "path" , map); map: A Map<String, Object> that contains the item configuration
"path": Identifier path used for context
Step 2: Build the ItemStack
Once loaded, you can build the final ItemStack using one of the following methods:
Or with additional options:
player: The player the item is built for (can be used for placeholders)
useCache: Set to false if you want to force rebuild instead of cached copy
placeholders: Optional dynamic values to insert in name/lore
You can load this item using:
And then:
You now have a reusable, customizable item system that supports placeholders, dynamic building, and centralized configuration.
This is especially useful for:
Last updated 7 months ago