# ⚙️ Configuration

This page explains how to create and configure **voucher items** using the voucher file. Vouchers allow you to execute commands when an item is used, with optional **conditions**, **permissions**, and **PlaceholderAPI** support. In game editor can be opened with `/voucher edit`.

***

### File Purpose

The voucher file is used to define **custom items** that:

* Execute **console or player commands**
* Support **conditional usage**
* Use **PlaceholderAPI** for dynamic checks
* Can act as **boosters, rewards, or consumables**

***

### Condition System

Conditions control **whether a voucher can be used**.

#### Supported Operators

| Operator | Meaning                            |
| -------- | ---------------------------------- |
| `&&`     | AND (both conditions must be true) |
| \`       |                                    |
| `==`     | Equals                             |
| `!=`     | Not equals                         |
| `<`      | Less than                          |
| `>`      | Greater than                       |
| `<=`     | Less than or equals                |
| `>=`     | Greater than or equals             |
| `!`      | NOT                                |
| `( )`    | Force execution order              |

***

#### &#x20;Execution Order

1. **Each condition is checked**
2. If **any condition fails**, its failure commands are executed
3. Voucher usage is **cancelled**
4. If **all conditions pass**, main commands execute

***

#### PlaceholderAPI Support

Conditions can use **PlaceholderAPI placeholders**.

**Important Notes**

* Placeholders must return a valid value
* If a placeholder fails to parse → the condition returns **false**
* String comparisons are **case-sensitive**

***

#### Example Condition

```
(%player_health% < 20 && %player_food% > 10) || !%player_is_flying%
```

✔ Allows usage if:

* Player has low health **and** enough food\
  **OR**
* Player is not flying

***

### Example: Instant Heal Voucher (With Conditions)

```yaml
instant_heal:
  Conditions:
    check_health:
      Condition: "%player_health% < 20"
      Console Commands:
        - "[MESSAGE] §cYou are already at max health!"

    check_gamemode:
      Condition: "%player_gamemode% == SURVIVAL"
      Console Commands:
        - "[MESSAGE] §cYou can only use this item in survival mode!"

    check_permission:
      Condition: "%luckperms_check_permission_vortexprisoncore.vouchers.item.instant_health% == yes || %luckperms_check_permission_vortexprisoncore.vouchers.all%"
      Console Commands:
        - "[MESSAGE_KEY:General.No Permission]"

  Console Commands:
    - "heal <player>"
    - "[MESSAGE] §aYou feel refreshed!"

  Item:
    Display Name: "§6§lInstant Heal"
    Material: "GOLDEN_APPLE"
    Enchantments:
      MENDING: 1
    Flags:
      - "HIDE_ENCHANTS"
    Lore:
      - "§7Heals you to max health."
```

***

### Example: Personal Money Booster Voucher

This voucher activates a **personal money booster** for the player.

```yaml
personal_money_booster:
  Item:
    Display Name: "§6§lPersonal Money Booster"
    Material: "EMERALD"
    Lore:
      - "§7Boosts your money gain by 50% for 1 hour."
    Enchantments:
      MENDING: 1
    Flags:
      - "HIDE_ENCHANTS"

  Console Commands:
    - "booster activate economy_money_booster <player> 1h"
```

***

### Item Section Explained

| Key            | Description                      |
| -------------- | -------------------------------- |
| `Display Name` | Item name (supports color codes) |
| `Material`     | Bukkit material name             |
| `Lore`         | Item description                 |
| `Enchantments` | Adds enchant glow                |
| `Flags`        | Hides enchantments or attributes |


---

# 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://wiki.vortexdevelopment.net/projects/vortexvouchers/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.
