Files
spigot-tree-feller/design/user-stories/us-005-undo-the-last-felled-tree.md
T

35 lines
2.6 KiB
Markdown

---
type: User Story
title: "US-005: Undo the last felled tree"
description: Safely restore the player's most recent automatic felling without creating replacement materials.
status: backlog
---
# US-005: Undo the last felled tree
As a **player**, I want to undo my latest automatically felled tree so that I can recover from an accidental chop without duplicating its materials.
## Acceptance criteria
- [ ] `/treefeller undo` targets only the issuing player's most recent automatic felling.
- [ ] An undo record contains only blocks successfully removed by the operation, including the initiating trunk block when its original state can be captured safely.
- [ ] Each record retains the world, block coordinates, original block material, and original block data needed to restore orientation and other supported state.
- [ ] Only one undo record is retained per player; a later felling replaces the earlier record after the later operation has removed at least one eligible tree block.
- [ ] An undo remains available for six minutes after the felling by default, with a configurable duration.
- [ ] Undo performs a complete preflight before changing the world or inventory.
- [ ] Preflight requires every target world and chunk to be available and every target position to remain safely restorable; an occupied or otherwise unsafe position fails the whole undo.
- [ ] Preflight calculates the exact replacement materials required to reconstruct all recorded trunk states and requires those aggregate materials in the issuing player's inventory.
- [ ] If inventory is insufficient, no item or block changes occur and the error lists every missing material with its missing quantity.
- [ ] On success, required materials are removed exactly once and all recorded blocks are restored as one logical operation.
- [ ] If an unexpected restoration failure occurs after preflight, the implementation avoids a silent partial result and reports the recovery action needed to administrators.
- [ ] A successful undo consumes the record so that it cannot be repeated.
- [ ] An expired, absent, already-used, or invalid undo produces a clear message and makes no changes.
- [ ] Undo restores trunk blocks only; it does not restore foliage, caps, roots, drops, experience, or axe durability.
- [ ] Undo has a distinct player permission and never grants access to `/treefelleradmin`.
## Related
- [US-003: Fell unlocked trees](us-003-fell-unlocked-trees.md)
- [US-004: Control personal tree felling](us-004-control-personal-tree-felling.md)
- [US-008: Configure and persist Tree Feller](us-008-configure-and-persist-tree-feller.md)