🇱🇷
zMenu
Marketplace
English
English
  • 🍾Getting started
  • 🔌Installing zMenu
  • ➕Supported Plugins
  • 👍zMenu+
  • â›°ī¸Configurations
    • â„šī¸Informations
    • 📜Commands and Permissions
    • đŸĒ§PlaceHolder
    • How to create an inventory step by step
    • 👨‍đŸ’ģInventories
    • âšī¸Buttons
    • 🏁Requirements
    • â˜ĸī¸Actions
    • đŸĒItems
    • Global Placeholders
    • 🔋Patterns
    • Commands
    • 🛝Player data
    • đŸĻŦConfig.json
  • API
    • â„šī¸Informations
    • Create Button
    • Create Material Loader
    • Create ButtonOption
    • Load Inventory
    • Fast Events
  • đŸ—ƒī¸Plugin's files
  • 🕍Example GUI menus
  • Update to new API
Powered by GitBook
On this page
Edit on GitHub
  1. API

Load Inventory

To load an inventory you have many methods present in the InventoryManager interface. But I advise you to use the loadInventoryOrSaveResource method. It allows you to retrieve the file in the resources of your plugin and save it.

try {
    // Attempt to load or save a custom inventory configuration from a YAML file
    this.inventoryManager.loadInventoryOrSaveResource(this.plugin, "inventories/paginate_inventory.yml");
} catch (InventoryException exception) {
    // Log any exceptions that occur during inventory loading
    exception.printStackTrace();
}
PreviousCreate ButtonOptionNextFast Events

Last updated 10 months ago