# Loot Configuration

**Definitions:**

* **Loot container**: A loot container is any container that can hold loot items. For example: **loot chests** or **air supplies**.
* **Loot item**: It's just an item that can be configured. You can configure its name, amount, data, chance, lore, etc..

***

The loot configuration system works in a similar way to the arena system. Each .yml inside the folder "**plugins/BattleRoyale/loot**" is a different configuration. This way each battlefield can have a different loot configuration; but also different battlefields can use the same loot configuration. Note that if you don't specify which loot configuration a particular battlefield will use, a random loot configuration from the loot configurations folder will be used.

The plugin will create a loot configuration named "**default.yml**" the first time it is running. You can modify this file, or even create a new loot configuration by creating a copy of it.

There are three main sections in a loot configuration:

* **initial**: The loot that players will receive at the start of the game.
* **chest**: The loot to fill the loot chests around the battlefield.
* **air-supply**: The loot to fill the air supplies.

You can put as many loot items as you want inside the previous sections.

***

## Maximum

This value represents the maximum number of loot items that can be put into a loot container (**loot chest, air supply, etc...**) **each 9 slots**.

```yaml
initial:
  # maximum number of items each 9 slot
  maximum: 2
  sandstone:
    material: SANDSTONE
    amount: 30
    ...
```

This can be confusing, but it is actually very simple. With this value you can control how many loot items can be found in a loot container. Minecraft inventories are divided in rows and columns:

![](https://i.imgur.com/vO8WlvC.png)

There are **9 columns** and **6 rows** in the image above. So if you set the **maximum** to **2** then **no more than 2 loot items** will be set in **each row**:

![](https://i.imgur.com/87NVdlf.png)

***

## How to setup a loot item

To create a loot item, simply create a new section within one of the main sections (**initial**, **chest**, or **air**-**supply**), then you must specify some values:

### material

The material of the item. **Not necessary if a plugin object is to be copied.**

### amount

The amount of the item.

### data

The special data of item; you can use this value to get for example a **Lapis Lazuli** (from **INK\_SACK**) in **legacy versions** (**< 1.13**).

### chance

Chance/probability of **spawning** . A value between **0** and **100** is **recommended**, however you can enter a number even **greater than 100**.

### plugin-object

The plugin object to copy. It can be a **BattleRoyale** object, or an object from another plugin that is supported (**QualityArmory**, **CrackShotPlus**, **CrackShot**, **MMOItems**, **etc**...).

* **BattleRoyale objects**: This is the list of objects that the **Battle Royale** plugin introduces:
  * **BRIDGE\_EGG**
  * **LAUNCH\_PAD**
  * **FIREBALL**
  * **TNT**
  * **ARENA\_SELECTOR**
  * **LEAVE\_ARENA**
  * **TEAM\_SELECTOR**
  * **SETTINGS**
* **MMOItems objects**: MMOItems are set a little bit differently:

  As **MMOItems are organized by type**, you must specify the **type** and the **item** in the following format: **\[type]:\[id]**. **Example**:

  ```
  initial:
    mmocutlass:
      plugin-object: 'SWORD:CUTLASS'
      amount: 1
      ...
  ```

#### Examples:

* **BattleRoyale object**:

  ```
  initial:
    bridge-egg:
      plugin-object: BRIDGE_EGG
      amount: 1
      ...
  ```
* **QualityArmory object**:

  ```
  initial:
    ak47u:
      plugin-object: ak47u
      amount: 1
      required:
      - '762:2'
      ...
  ```
* **CrackShotPlus object**:

  ```
  initial:
    ak-47-csp:
      plugin-object: AK-47_CSP
      amount: 1
      ...
  ```
* **MMOItems objects**:

```
initial:
  mmocutlass:
    plugin-object: 'SWORD:CUTLASS'
    amount: 1
    ...
```

### required

The loot items that are required to spawn along with this item.

There are **two ways** to set the required loot items (**you can do pretty much the same with both**):

* **List**: A string list (**like the lore**) where each line (with the format: \[**loot item**/**plugin object**]:\[**amount**]) represents a required loot item. **Example**:

  ```
  air-supply:
    bow:
      material: BOW
      amount: 1
      data: 0
      chance: 20.0
      required:
      - 'arrow:10'
    arrow:
      material: ARROW
      amount: 30
      ...
  ```
* **Section**: A section where each sub-section represents a required loot item. Note that unlike the previous way (**list**), you are creating a new loot item; so, as you will notice, this way is useful when you need a completely personalized item. **Example**:

  ```
  air-supply:
    bow:
      material: BOW
      amount: 1
      data: 0
      chance: 20.0
      required:
        arrow:
          material: ARROW
          amount: 30
  ```

This is useful in cases where, for example, you need a bow to spawn with arrows or a certain weapon to spawn with its ammunition.

<br>


---

# 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://adriansr.gitbook.io/battleroyale/battlefield-setup/loot-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.
