Mailbox
This datapack introduces mailboxes in the form of barrels that allow players to exchange items with each other. This system is specifically designed for multiplayer servers.
Setting Up Your Personal Mailbox
To create your mailbox, find an empty barrel and look directly at it, then execute the command /trigger set-mailbox. This barrel will become your personal mailbox. All items sent to you by other players will appear in this specific barrel.
If you want to change the location of your mailbox, simply break the current barrel and repeat the setup procedure with a new one.
Sending Mail to Other Players
To send items, execute the command /trigger send-mail. A special barrel will appear in front of you, and detailed instructions for further actions will be displayed in the chat.
You can send mail to other players even when they are offline or when the chunk containing their mailbox is not loaded. Having your own mailbox is not required to send mail.
Additional Features and Settings
- To remove the datapack, use the command
/function mailbox:uninstall. - To allow mail sending only within a 10-block radius of any mailbox, execute
/scoreboard players set MustBeNearMailboxToSend mailbox.config 1. By default, this option is disabled (value 0), allowing mail to be sent from anywhere in the world. - To create a send-only mailbox, use the command
/function mailbox:send-only-mailbox/set. Such mailboxes are particularly useful in combination with the 10-block radius rule. - The system tracks statistics of sent and received mail for each player through the counters
mailbox.stats.sentandmailbox.stats.received.
This datapack is built using the PlayerDB library, which significantly simplified development.
The idea for creating this mailbox system emerged after watching a Hermitcraft video that demonstrated similar mechanics. It became an interesting challenge to recreate comparable functionality using datapacks.