add "trade modified" warning if items are removed/reduced, configurable

Add config for requiring second confirmation screen, enabled by default
More resilience to adding items to trade after moving to confirmation screen
This commit is contained in:
trunksbomb
2026-03-25 12:27:20 -04:00
parent 4daed48f0e
commit 89d6545533
8 changed files with 242 additions and 38 deletions

View File

@@ -12,6 +12,7 @@ Players can request a trade, review both offers in a shared GUI, accept once to
- Shared trade screen with separate offer areas for both players
- Two-step confirmation flow
- Quantity-based item selection with quick amounts and `Trade X`
- Warning if items are removed/modified
- Inventory-safe finalization: nothing changes until safety and security checks pass and the trade succeeds
- Configurable trade safety checks to prevent dangerous mid-combat or mid-movement trading
- Per-player trade toggles and ignore list support
@@ -49,6 +50,12 @@ They can also respond manually:
- Once both players accept, the screen enters the confirmation stage
- Click `Confirm` to finalize
If a player reduces or removes items from an offer:
- any pending accepts / confirms are invalidated
- the changed offer slot gets a blinking red border and `!`
- the trade window shows a red `Trade Modified` warning
## Commands
### Player commands
@@ -109,6 +116,7 @@ The trade verifies:
- both players are still within configured trade distance, if enabled
- both live inventories still match the snapshots taken when the trade started
- both players can receive the incoming items
- both players have re-accepted after any offer changes
If any check fails, the trade is cancelled and both players receive an explicit chat message explaining why.
@@ -133,6 +141,16 @@ Server config values live under the `trade` section.
- default: `false`
- enables debug commands and debug UI/testing tools
### Trade flow
- `requireSecondConfirmation`
- default: `true`
- requires the second confirm step after both players accept the offer
- `showTradeModifiedWarnings`
- default: `true`
- shows the `Trade Modified` warning and changed-slot highlights when offers are reduced or removed
### Safety
- `requireOnGround`
@@ -196,4 +214,4 @@ Debug tools are disabled by default and only available when:
- `enableDebugFeatures = true`
When enabled, the mod exposes `/trade debug ...` commands and on-screen debug controls for single-client testing.
When enabled, the mod exposes `/trade debug ...` commands and on-screen debug controls for single-client testing.