6.8 KiB
Trade
Trade is a NeoForge mod for Minecraft 1.21.1 that adds a secure player-to-player trading interface inspired by Runescape.
Players can request a trade, review both offers in a shared GUI, accept once to lock the offer, and confirm a second time to complete the exchange.
Features
- Player-to-player trade requests with an accept / decline handshake
- 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
- Configurable per-player request cooldowns
- Per-player trade toggles and ignore list support
- Admin-controlled player and item trade blacklists, with config defaults and live commands
- File-based trade audit log for server operators
Player Usage
Starting a trade
Primary flow:
- Use the trade keybind (default:
G) while looking at another player
Command option:
/trade <player>
When a request is sent, the target player receives chat text with a clickable accept link.
They can also respond manually:
/trade yes
/trade no
In the trade screen
- Click an item in your inventory to trade
1 - Right-click an item to open the quantity menu
- Use
Trade Xto enter a custom amount - Click
Acceptwhen your offer is ready - Once both players accept, the screen enters the confirmation stage
- Click
Confirmto 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 Modifiedwarning
Commands
Player commands
/trade <player>
/trade yes
/trade no
/trade toggle
/trade on
/trade off
/trade ignore <player>
/trade unignore <player>
/trade ignorelist
Admin commands
Server operators can manage persistent live blacklists with:
/trade admin playerblock add <player|uuid>
/trade admin playerblock remove <player|uuid>
/trade admin playerblock list
/trade admin itemblock add item <namespace:item>
/trade admin itemblock remove item <namespace:item>
/trade admin itemblock add tag <namespace:tag>
/trade admin itemblock remove tag <namespace:tag>
/trade admin itemblock add mod <modid>
/trade admin itemblock remove mod <modid>
/trade admin itemblock list
Command behavior
/trade <player>sends a trade request/trade yesaccepts the current pending trade request/trade nodeclines the current pending trade request/trade toggleflips whether you accept incoming trade requests/trade onenables incoming trade requests/trade offdisables incoming trade requests/trade ignore <player>blocks trade requests from that online player/trade unignore <player>removes that online player from your ignore list/trade ignorelistshows your ignored players
Trade Safety
By default, the mod blocks trade requests or acceptance unless both players are in a safe state.
Default safeguards:
- on solid ground
- standing still
- not recently damaged
- not on fire
- not in liquid
- not sleeping
- not gliding
- not mounted
- in the same dimension
There is also a special delayed-accept flow for the most common transient failure:
- if the other player accepts while you are only moving or in the air, the request does not fail immediately
- instead, you get an on-screen countdown
- if you get safe in time and remain still long enough, the trade opens automatically
Final Validation
When both players confirm, the trade is checked one last time before any real inventory is changed.
The trade verifies:
- both players are still in the same dimension, if that config is enabled
- 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.
Configuration
Server config values live under the trade section.
Request / range
-
tradeCommandProximity- default:
0 0disables range checks1+requires players to be within that many blocks to request, accept, and finalize a trade
- default:
-
requestTimeoutSeconds- default:
30 - number of seconds before a pending trade request expires
- default:
-
requestCooldownSeconds- default:
5 - number of seconds a player must wait before sending another trade request
- default:
Debug
enableDebugFeatures- default:
false - enables debug commands and debug UI/testing tools
- default:
Trade flow
-
requireSecondConfirmation- default:
true - requires the second confirm step after both players accept the offer
- default:
-
showTradeModifiedWarnings- default:
true - shows the
Trade Modifiedwarning and changed-slot highlights when offers are reduced or removed
- default:
Safety
-
requireOnGround- default:
true
- default:
-
requireStationary- default:
true
- default:
-
stationarySpeedThreshold- default:
0.03
- default:
-
requireNoRecentDamage- default:
true
- default:
-
noDamageSeconds- default:
10
- default:
-
requireNotOnFire- default:
true
- default:
-
requireNotInLiquid- default:
true
- default:
-
requireNotSleeping- default:
true
- default:
-
requireNotFallFlying- default:
true
- default:
-
requireNotRiding- default:
true
- default:
-
requireSameDimension- default:
true
- default:
Admin blacklists
-
adminDisabledPlayerUuids- default:
[] - UUIDs of players who cannot use the trade system at all
- default:
-
adminBlacklistedItemIds- default: command blocks, command block minecarts, barriers, bedrock, end portal blocks/frames, structure blocks, jigsaws, lights, and spawners
- exact item ids that cannot be traded, like
minecraft:diamond
-
adminBlacklistedItemTags- default:
[] - item tags that cannot be traded, like
minecraft:logs
- default:
-
adminBlacklistedMods- default:
[] - mod namespaces that cannot be traded, like
minecraft
- default:
Config blacklist entries are treated as defaults. Live admin commands add and remove separate saved entries that persist across restarts.
Audit Log
The mod writes a trade audit log to:
logs/trade.log
Entries include:
- trade requests
- request accepts / declines / expirations
- trade opens
- trade cancels
- trade completions
- player names
- UUIDs
- dimensions
- block coordinates
- items offered by each side
- final result text
Debug Mode
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.
