# PvP & Security

Combat tag, anti-logout, anti-spawn-camp, anti-stash, pet protection, death-loot protection, sieges and the ignore/soft-mute system.

## PvP rules

```yaml
PvP:
  Enabled: true                 # global master switch
  RulesEnabledInWorld:          # decides PER WORLD whether PvP happens
    "*": false                  # default: PvP off everywhere, enable worlds explicitly
  CombatTimeoutSeconds: 15      # how long you count as in combat after the last hit
  BlockedCommands: [home, spawn, tpa, tpaccept, tpahere, warp, back, tp, teleport, rtp]
  AllowCombatItemDrop: false    # dropping items in combat
  ProtectPlayersInLandClaims:   # victim location decides
    PvPWorld: false
    NonPvPWorld: true
  ProtectPlayersInAdminLandClaims: true
  ProtectPlayersInSubdivisions: false
```

Whether PvP runs in a world is decided solely by `RulesEnabledInWorld`. In blocked worlds the damage is cancelled; in allowed worlds both participants are combat-tagged (including projectiles).

The PvP ban (world without PvP rules or a protecting claim) covers every attack path: melee, arrows, splash and lingering potions with a harmful effect (poison, harming, weakness, slowness), TNT, end crystals, tamed wolves and the fishing rod. For potions the protected player is removed from the effect; everyone else is hit normally.

| Additional permissions | Default | Description |
|---|---|---|
| `mira.claim.nopvpimmunity` | op | Waives PvP protection in non-PvP worlds AND fresh-spawn invincibility |
| `mira.claim.siegeimmune` | op | Cannot be sieged |

> **Warning:** Without at least one `true` world in `RulesEnabledInWorld` the whole combat system (anti-logout, anti-stash, command block) never triggers, since it needs a PvP hit to happen first.

> **Tip:** Claim PvP protection has two deliberate exceptions: an already combat-tagged victim stays attackable (no escape-claim mid-fight), and during a siege between the participants it is lifted. The owner can also switch it off for their claim via the `pvp_override` claim flag (see Trust & Protection, claim flags). `AllowPearlsToPvpZones` is a reserved key with no function; ender pearls are governed by `Claims.EnderPearlsRequireAccessTrust`.

**Combat tag:** every hit extends both players' tag. Red boss bar with countdown, expires automatically, removed on death. On logout the status persists (for the anti-logout penalty) and the bar returns on rejoin.

**Command block in combat:** the first word of every command is checked against `BlockedCommands`; GUI teleports are also caught. Bed, end portal and world changes stay free.

## Anti-logout

`PvP.PunishLogout: true` (default): if a combat-tagged player logs out, their full inventory is dropped at their location (with death-loot protection), health is set to 0 and the action is written to the audit log.

## Anti-spawn-camp

`PvP.ProtectFreshSpawns: true` (default): invincibility for `FreshSpawnDurationSeconds` (10 s) after every respawn, with a green boss bar. The very first login is the [join protection](joinprotection.md)'s job; while that still runs and covers every kind of damage (`mode: all`), no second bar is laid over it.

The protection ends instantly if the protected player attacks or picks up an item (the pickup is still blocked then). Splash potions bounce off without ending it.

## Anti-stash

Combat-tagged players cannot drop items (`AllowCombatItemDrop: false`) and cannot open foreign inventories (chests, furnaces, ender chests, even Mira menus). Own inventory and crafting stay free.

## Pet protection

Applies to tamed wolves, cats, parrots, horse-likes, axolotls, foxes and allays.

| Action | Rule |
|---|---|
| Damage | Only the owner hits (also projectiles), exceptions below; environment damage stays |
| Feed/lure | Owner only |
| Leash | Owner only |
| Ride | Owner always; others only with access trust in a claim of the owner at the spot |
| Re-tame | Rejected if the animal already belongs to someone |

A non-owner may hurt a tamed animal when it is attacking them, when owner and attacker are in the same siege, or in PvP worlds outside protecting claims (same rules as for players). Otherwise the pet stays protected.

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| Give pet | `/givepet` | (no permission checked) | true | Selection mode: next right-click on your own animal, then name entry + confirmation |

> **Tip:** `/givepet` checks ownership three times (selection, entry, confirmation) and can be disabled via `Pets.EnableGivePetCommand: false`.

## Death-loot protection

All death drops are pickup-only by the owner for `PvP.LootProtectionSeconds` (180 s); `<= 0` disables the marking. Once the owner picks the drops up again or the time runs out, the items are ordinary items again (they stack and can be handed over). Hoppers do not collect protected drops.

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| Unlock own drops | `/claim unlockdrops` | `mira.claim.claim.unlockdrops` | true | Unlocks your protected drops |
| Unlock foreign drops | `/claim admin unlockdrops <player>` | `mira.claim.claim.admin.unlockdrops` | op | Unlocks foreign drops server-wide |

## Sieges

Optional, off by default.

```yaml
Sieges:
  Enabled: false
  MaxDurationSeconds: 1800
  Worlds: []        # empty = all worlds allowed
```

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| Start siege | `/claim siege <player>` | `mira.claim.claim.siege` | true | Sieges a player in their own claim |

Start conditions: system on, world allowed and a PvP world, target online, not `siegeimmune`, neither already in a siege, both standing in the target's claim. On start both are combat-tagged; the attacker may build and break in the sieged claim.

Ends on: death of a participant, defender leaves their claim, logout (triggers the anti-logout penalty) or timeout.

## Ignore & soft-mute

Independent of PvP.

| Command | Syntax | Permission | Default | Description |
|---|---|---|---|---|
| Ignore | `/ignoreplayer <player>` (`/ignore`) | (no permission) | true | Hides a player's chat |
| Unignore | `/unignoreplayer <player>` (`/unignore`) | (no permission) | true | Stops ignoring |
| List | `/ignoredplayerlist` (`/ignorelist`) | (no permission) | true | Shows your ignore list |
| Soft-mute | `/softmute <player>` | `mira.claim.softmute` | op | Only visible to other soft-muted players |
| Separate | `/separate <p1> <p2>` | `mira.claim.admin` | op | Forces mutual ignoring |

| Additional permissions | Default | Description |
|---|---|---|
| `mira.claim.notignorable` | op | Cannot be ignored or soft-muted |
| `mira.claim.eavesdrop` | op | Reads private messages (`/msg`, `/tell`, ...) |
| `mira.claim.eavesdropsigns` | op | Gets every new sign text reported |

> **Note:** `Spam.Enabled` is a reserved placeholder with no function (Mira handles chat moderation). No SmartBan/anti-alt system exists; use a separate plugin for that.

## Full example config

```yaml
PvP:
  Enabled: true
  RulesEnabledInWorld:
    "*": false
    pvp_world: true
  ProtectFreshSpawns: true
  FreshSpawnDurationSeconds: 10
  PunishLogout: true
  CombatTimeoutSeconds: 15
  AllowCombatItemDrop: false
  BlockedCommands: [home, spawn, tpa, tpaccept, tpahere, warp, back, tp, teleport, rtp]
  ProtectPlayersInLandClaims:
    PvPWorld: false
    NonPvPWorld: true
  ProtectPlayersInAdminLandClaims: true
  ProtectPlayersInSubdivisions: false
  LootProtectionSeconds: 180

Sieges:
  Enabled: true
  MaxDurationSeconds: 1800
  Worlds:
    - pvp_world

Pets:
  EnableGivePetCommand: true
```
