--- type: User Story title: "US-002: Relinquish protection when attacking" description: Remove Leaf protection when an opted-in player attacks another player. status: done --- # US-002: Relinquish protection when attacking As a **player facing PvP**, I want Leaf protection to belong only to non-aggressors so that protected players cannot keep its advantage after fighting back. ## Acceptance criteria - [x] When an opted-in player damages another player, Leaf automatically changes the attacker's saved choice to opted out. - [x] Automatic opt-out immediately removes Leaf-managed Resistance and the attacker's leaf prefix. - [x] The attacker receives a clear chat message explaining that attacking another player disabled Leaf and that they may opt in again when permitted. - [x] Receiving player-caused damage without retaliating does not change the protected player's choice or Resistance. - [x] Retaliatory damage counts as attacking, including Thorns damage attributable to the protected player. - [x] Direct melee attacks and player-fired projectiles are attributed to the attacking player. - [x] Harmful splash or lingering potion damage is attributed to the player who threw the potion. - [x] Damage caused by a tamed animal is attributed to its player owner when Spigot exposes that ownership. - [x] TNT, fire, and other indirect damage trigger opt-out only when Spigot exposes a reliable responsible player; ambiguous environmental damage does not opt out an innocent player. - [x] PvP-triggered opt-out applies even when an administrator has locked the player's preference. - [x] A single attack produces no duplicate state changes or duplicate notifications. ## Related - [US-001: Opt into Leaf protection](us-001-opt-into-leaf-protection.md) - [US-003: Identify protected players](us-003-identify-protected-players.md) - [US-005: Administer Leaf](us-005-administer-leaf.md)