Files
dmg 3960672104
Release / release (push) Successful in 2m54s
CI / build (push) Failing after 18m56s
feat(tools): replace broken main-hand tools
2026-09-04 12:00:56 -04:00

27 lines
1.3 KiB
Markdown

---
type: User Story
title: "US-004: Automatically replace broken tools"
description: Move an equivalent inventory tool into the player's hand when their current main-hand tool breaks.
status: done
---
# US-004: Automatically replace broken tools
As a **player**, I want an equivalent tool moved into my hand when my current tool breaks so that I can continue working without searching my inventory.
## Acceptance criteria
- [x] When a player's main-hand tool breaks, the plugin searches the player's inventory for a replacement.
- [x] A replacement must have the same tool type and material as the broken tool; for example, a diamond pickaxe replaces only a diamond pickaxe.
- [x] Eligible replacements may come from the main storage inventory or another hotbar slot.
- [x] The replacement is moved into the currently selected hotbar slot.
- [x] Existing durability, enchantments, custom names, persistent data, and other metadata on the replacement are preserved.
- [x] No unrelated item is moved when an equivalent replacement is unavailable.
- [x] Off-hand tool breakage does not replace the main-hand item.
- [x] Cancelled damage or break events do not trigger replacement.
- [x] Automated tests cover matching, unavailable replacements, hotbar and main-storage candidates, metadata preservation, and off-hand behavior.
## Related
- [User-story catalog](index.md)