# 💻 Virtual Crates & Keys

With ExcellentCrates you can create both, **virtual crates** and **keys**. And you can link them to each other with no limits!&#x20;

Virtual crates can use both, **virtual** and **physical keys**, and vice versa. You can even require virtual and physical key(s) per a crate at the same time <mark style="color:orange;">(but player needs only one of them)</mark>!

## Creating Virtual Keys

To create a virtual key, follow simple steps:

1. Go to `/crate editor` -> **Keys** -> **New Key**
2. Enter key unique indentifier.
3. A new key will appear. Click it.
4. Find and click `Virtual` button. It should say **Enabled**.
5. Key is virtual now!

When making key virtual, you can notice that `Key Item` setting disappears from the editor. That's correct, because virtual keys shouldn't be obtainable as inventory items.

## Creating Virtual Crates

Unlike keys, there is not explicit setting for crates to make it virtual. Instead, there is a directory called `/menu/` which you can utilize to display virtual crates for players, so they can interact with them.&#x20;

{% hint style="info" %}
Simply don't give your virtual crates as inventory items and don't place them in the world.
{% endhint %}

{% hint style="info" %}
Clicks used to interact with virtual crates (open, preview) equals to the clicks you set in **config.yml** -> **Crate** -> **Click\_Actions**
{% endhint %}

In that `/menu/` directory you will see a `default.yml` config file. It is an example of GUI configuration file that you can customize for your own preferences.

{% hint style="info" %}
Feel free to create your own configuration files for virtual crate menus. Simply duplicate an existent one, rename it and edit as you like!
{% endhint %}

Menu configs contains a few important settings to add your virtual crates there:

* **Crate** -> **Name** - This is generic name template for all virtual crates of this menu. You can use [Crate Placeholders](../../utility/placeholders#crate-placeholders) there.
* **Crate** -> **Lore** - This is generic lore template for all virtual crates of this menu. You can use [Crate Placeholders](../../utility/placeholders#crate-placeholders) there.
* **Crate** -> **Slots** - This is the <mark style="color:red;">**most important**</mark> setting required for virtual crates to appear in the menu. Add there IDs of your virtual crates and slot number where they will appear. Crate ID is the same as crate config file name <mark style="color:orange;">(without the .yml extension)</mark>.

{% hint style="info" %}
Virtual crate icon in the menu is the same as **Crate Item** you set in editor.
{% endhint %}

It should look something like this:

```
Crate:
  Name: '%crate_name%'
  Lore:
  - <light_gray>You have <light_yellow>%keys%</light_yellow> keys.</light_gray>
  - ''
  - <light_gray><light_yellow>[▶]</light_yellow> Left-Click to <light_yellow>preview</light_yellow>.</light_gray>
  - <light_gray><light_yellow>[▶]</light_yellow> Right-Click to <light_yellow>open</light_yellow>.</light_gray>
  Slots:
    gold_crate: 11 # Golden Crate at 11 slot
    emerald_crate: 13 # Emerald Crate at 13 slot
    diamond_crate: 15 # Diamond Crate at 15 slot
```
