feat(combat): opt out attacking players

This commit is contained in:
dmg
2026-08-10 18:24:02 -04:00
parent 1b622211cb
commit d1427fbe38
12 changed files with 293 additions and 15 deletions
+7
View File
@@ -42,3 +42,10 @@
- Name cleanup restores only values Leaf installed; third-party changes are preserved.
- Documented scoreboard, custom chat, tab-list, and per-viewer scoreboard limitations.
- US-003 remains in progress until combat and global administration paths are verified.
### US-002 combat opt-out completed
- Added modern Spigot damage-source attribution for direct attacks, projectiles, thrown potions, area clouds, tamed animals, TNT, Thorns, and other reliably attributed sources.
- Ambiguous, cancelled, zero-damage, environmental, and self damage do not opt out a player.
- Combat opt-out bypasses administrative locks, immediately reconciles effect and prefix state, persists once, and sends one explanatory message.
- Verified attribution, victim safety, lock bypass, duplicate suppression, and the full build with `./gradlew clean check jar`.
@@ -2,7 +2,7 @@
type: User Story
title: "US-002: Relinquish protection when attacking"
description: Remove Leaf protection when an opted-in player attacks another player.
status: backlog
status: done
---
# US-002: Relinquish protection when attacking
@@ -11,17 +11,17 @@ As a **player facing PvP**, I want Leaf protection to belong only to non-aggress
## Acceptance criteria
- [ ] When an opted-in player damages another player, Leaf automatically changes the attacker's saved choice to opted out.
- [ ] Automatic opt-out immediately removes Leaf-managed Resistance and the attacker's leaf prefix.
- [ ] The attacker receives a clear chat message explaining that attacking another player disabled Leaf and that they may opt in again when permitted.
- [ ] Receiving player-caused damage without retaliating does not change the protected player's choice or Resistance.
- [ ] Retaliatory damage counts as attacking, including Thorns damage attributable to the protected player.
- [ ] Direct melee attacks and player-fired projectiles are attributed to the attacking player.
- [ ] Harmful splash or lingering potion damage is attributed to the player who threw the potion.
- [ ] Damage caused by a tamed animal is attributed to its player owner when Spigot exposes that ownership.
- [ ] 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.
- [ ] PvP-triggered opt-out applies even when an administrator has locked the player's preference.
- [ ] A single attack produces no duplicate state changes or duplicate notifications.
- [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