# How to create Custom Trades

### #1. Use template to start off your own trade

Trades.yml file (*located in your server folder -> plugins -> AdvancedTrades folder*) has 2 trades by default. You can add your own trade by pasting this example to your file:

```yaml
  'tradeName': # Trade name, this can be anything you want
    tradeSettings:
      chance: 5 # Chance of villager acquiring this trade
      requiredVillagerLevel: 'none' # Required villager level, read more at https://trades.advancedplugins.net/trades/levels
      requiredProfession: # Required villager profession, read more at https://trades.advancedplugins.net/trades/professions
        - 'none' # If set to none, required profession is disabled
      requiredBiome: # Required villager's biome for this trade, read more at https://trades.advancedplugins.net/trades/biomes
        - 'none' # If set to none, required profession is disabled
      maxTradeUses: 'none' # This trade's limit per villager. Read more at https://trades.advancedplugins.net/trades/limits
    tradeIngredients: # Items required for a trade, read more at https://trades.advancedplugins.net/configuration/items
      # MAXIMUM OF 2 INGREDIENTS PER TRADE!
      '1':
        type: EMERALD
        amount: 15
      '2':
        type: DIAMOND_SWORD
        amount: 1
    tradeResult: # Item which villager will offer in exchange of trade ingredients
      villager:
        experience: 5 # Experience gained by villager with this trade, read more at https://trades.advancedplugins.net/trades/levels
      item: # Item given by villager to player at trade, read more at https://trades.advancedplugins.net/configuration/items
        type: 'DIAMOND_SWORD'
        amount: 1
        name: '&cCustom Sword'
        lore:
          - '&dExclusive from &dVillagers'
        enchantments:
          - 'Sharpness:5'
          - 'Unbreaking:2'
```

### #2. Trade Settings Configuration

Firstly you can change your trade name. In the example above, it's changeable in `'tradeName'` part. Change this **tradeName** to anything else, e.g. **villagerTrade6**.&#x20;

Under **trade settings**, you can configure:

* `chance` - change the chance of this trade appearing in villager trades&#x20;
* `requiredVillagerLevel` - level required for trades to appear, read more at <https://trades.advancedplugins.net/trades/levels>
* `requiredProfession` - required profession, read more at <https://trades.advancedplugins.net/trades/professions>
* `requiredBiome` - required biome for villager to spawn in, for this trade to appear. Read more at <https://trades.advancedplugins.net/trades/biomes>
* `maxTradeUses` - max uses for this trade on a villager, read more at <https://trades.advancedplugins.net/trades/limits>

### #3. Trade Ingredients Configuration

Under **trade ingredients**, you can configure items required for a trade. In vanilla minecraft, it's usually emeralds + another item which turns into traded item. E.g. emeralds and a book, which then can be traded for an enchanted book. You do not need to follow this format.

You are not required to have 2 items either. Maximum is 2, minimum is 1.

Follow this guide on how to configure required items: <https://trades.advancedplugins.net/configuration/items>

### #4. Trade Result Configuration

Trade can result either in item being awarded upon a trade or a command. Alongside this, you can also give the villager experience, which may level the villager up.

`experience` - apply this experience to level up the villager, read more at: <https://trades.advancedplugins.net/trades/levels>

#### Configuration for awarding items:

Edit the `item` part in `tradeResult` block. You need to follow this guide on how to edit this item: <https://trades.advancedplugins.net/configuration/items>

#### Configuration for commands:

With AdvancedTrades, you can trade custom commands instead of items. Though, the rewarded item will still be displayed just as a display only, won't be traded. You can use this item to explain the reward to user as they won't be able to see what command they are trading for.

The actual commands can be configured following this guide: <https://trades.advancedplugins.net/configuration/commands>


---

# 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://trades.advancedplugins.net/trades/how-to-create-custom-trades.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.
