Inventory configuration

This page describes how to configure an inventory in YAML.

CraftVentory enables developers to create fully customizable inventories from configuration files. YAML is the default file format supported by the library for this purpose.

How to configure an inventory?

Each inventory must be defined in a separate configuration file. It is represented by a set of properties which are listed below:

Id

# An id that uniquely identify the inventory.
inventory-id: "inventory-id"

Type

# The type of view that will be used for the inventory.
# Available types:
# - CHEST_9x1 (1 row)
# - CHEST_9x2 (2 rows)
# - CHEST_9x3 (3 rows)
# - CHEST_9x4 (4 rows)
# - CHEST_9x5 (5 rows)
# - CHEST_9x6 (6 rows)
# - DROPPER
# - HOPPER
type: "CHEST_9x6"

Title

# The title of the inventory.
# The following placeholders are available by default:
# - %player_name% : The name of the player who is viewing the inventory.
# - %inventory_type% : The name of the inventory type.
# - %inventory_size% : The number of slots of the inventory.
title: "title"

Pattern

# The pattern of the inventory used to set items.
# A pattern must have the exact same number of rows and columns than the inventory.
# Items are represented by their associated symbol in the pattern.
# The symbol '&' must be used to represent an empty slot.
pattern:
  - "&&&&&&&&&"
  - "&1111111&"
  - "&1111111&"
  - "&1111111&"
  - "&P&&&&&N&"
  - "&&&&&&&&C"

Content

# The content of the inventory.
# You can add as many items as you want.
content:
  # Each item is described by a section.
  close:
    # The item to display.
    # You can use the default YAML representation supported by Bukkit to define an ItemStack
    # or the custom one provided by the library.
    item:
      type: BARRIER
    # Symbol used in the pattern to place the item in the inventory.
    # You must ensure that two items do not have the same symbol.
    symbol: "C"
    # Actions executed when a player clicks on the item.
    # Each action is described by a new element in the list.
    actions:
      # The name of the action.
      - action: "CLOSE"

Paginations

# Paginations used in the inventory.
# An inventory can contain several paginations.
paginations:
  # Each pagination is described by a section.
  pagination-1:
    # The internal id of the pagination.
    # It must be unique for the inventory, as an inventory can contain several paginations.
    id: "pagination-1"
    # The symbol used in the pattern to place the pagination items in the inventory.
    symbol: "1"
    # The item used to represent each value of the pagination.
    # The Bukkit ItemStack representation must be used.
    pagination-item:
      item:
        type: DIAMOND
    # Item to open the previous page.
    # It is configured like items in the 'content' section.
    previous-page-item:
      # Item displayed when a previous page is available.
      navigation-item:
        item:
          type: ARROW
          # The following placeholders are available by default and can be used in name and lore:
          # %previous_page%: Previous page number.
          # %current_page%: Current page number.
          # %total_pages%: Total number of pages.
          name: "Page %previous_page%"
      symbol: "P"
    # Item to open the next page.
    # It is configured like items in the 'content' section.
    next-page-item:
      # Item displayed when a next page is available.
      navigation-item:
        item:
          type: ARROW
          # The following placeholders are available by default and can be used in name and lore:
          # %next_page%: Next page number.
          # %current_page%: Current page number.
          # %total_pages%: Total number of pages.
        name: "Page %next_page%"
      symbol: "N"

Item configuration

An inventory is composed of a set of items. CraftVentory uses the CraftStack library for item configuration. You can check this documentation to know about the currently supported item properties that can be used in an item configuration.

Last updated