# Inventory configuration

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

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

#### Type

```yaml
# 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

```yaml
# 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

```yml
# 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

```yml
# 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

```yml
# 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](https://github.com/Syr0ws/CraftStack) library for item configuration. You can check [this documentation](https://github.com/Syr0ws/CraftStack/wiki/Item-components) to know about the currently supported item properties that can be used in an item configuration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://syrows-development.gitbook.io/craftventory/get-started/inventory-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
