# regenzone.yml

The **Regen Zone Manager** is nwMVP’s built-in block regeneration system.\
It controls how blocks and crops regenerate **inside territories only**.

This system works **only when** the following is set in `config.yml`:

```yml
regen-block-plugin: "nwmvp"
```

Regen Zones are created via **commands**, not in this file.

***

## 🔄 How Regen Zone Works

When a player breaks a block inside a regen zone:

1. Block break is detected
2. Territory and regen zone are checked
3. Region name is matched against `allow-regen-regions`
4. Block or crop is matched in group config
5. Vanilla drops are cancelled
6. Custom `drop-items` are given
7. Block becomes BEDROCK (or AIR for crops)
8. After cooldown, block is restored

***

### ⏱️ Cooldown

```yml
cooldown: 10
```

Defines how long (in seconds) blocks take to regenerate.

* Applies globally
* Recommended: `5–60` seconds

***

### 📦 Groups

Groups define **which blocks regenerate in which regions**.

* One group → many regions
* One region → many groups (first match wins)
* Group names must be unique

***

### 1️. allow-regen-regions

Defines which **territory regions** the group applies to.

* Must match territory region names exactly
* Case-sensitive

***

### 2. Blocks (Vanilla Blocks)

The **Blocks** section defines how **standard Minecraft blocks** (vanilla blocks) regenerate inside Regen Zones and what items they drop when broken.

This allows you to fully control:

* Which blocks can regenerate
* What items players receive
* How mining behaves inside territory zones

```yaml
blocks:
  DIAMOND_ORE:
    drop-items:
      - "diamond"
      - "basic_reward"
```

***

#### How It Works

When a player breaks a vanilla block inside a regen zone:

1. The system detects the block break event
2. Checks whether the block is inside a valid **territory regen zone**
3. Confirms the territory region is listed in `allow-regen-regions`
4. Matches the broken block with a configured block in `blocks`
5. **Cancels the default Minecraft drops**
6. Gives the player the configured `drop-items`
7. Temporarily replaces the block with **BEDROCK**
8. After the global `cooldown`, the block is restored to its original material

***

#### Block Identifier Rules

* Must be a valid **Minecraft Material enum**
* Case-sensitive
* Use **UPPERCASE** with underscores

✅ Valid examples:

* `DIAMOND_ORE`
* `COAL_ORE`
* `IRON_ORE`
* `EMERALD_ORE`

***

### 3. Custom Blocks

The **Custom Blocks** system allows regen zones to work with blocks from other plugins.

Supported plugins:

* **Nexo**
* **ItemsAdder**
* **CraftEngine**

Custom blocks behave exactly like vanilla blocks once configured.

```yaml
blocks:
  RUBY_ORE:
    type: "nexo"
    id: "ruby_ore"
    drop-items:
      - "diamond"
      - "basic_reward"
```

***

#### Required Fields

| Field        | Description                       |
| ------------ | --------------------------------- |
| `type`       | Plugin that provides the block    |
| `id`         | Exact block ID used by the plugin |
| `drop-items` | Items to drop when broken         |

***

#### Supported Types

| Type          | Plugin                    |
| ------------- | ------------------------- |
| `nexo`        | Nexo custom blocks        |
| `itemsadder`  | ItemsAdder custom blocks  |
| `craftengine` | CraftEngine custom blocks |

***

### 4️. Crops

Defines crop regeneration behavior.

* Crops temporarily become AIR
* Restore as fully grown crops
* Custom drops supported

```yaml
crops:
  CARROTS:
    drop-items:
      - "iron_ingot"
```

#### ❗ Important Limitations

✔ Works with:

* nwMVP territory system
* Vanilla + custom blocks
* Drop tables

✖ Does NOT work with:

* Other regen plugins
* Non-territory areas
* Unconfigured blocks
