Building a restart-safe Minecraft death chest plugin without losing items
Death chests look simple until you test the edge cases. A player dies with a full inventory and armor, the server restarts before they return, another player tries to open the grave, an explosion chain starts nearby, and suddenly the "simple" chest plugin is deleting items or duplicating XP. While building GraveGuard 1.1.0 for Paper 1.21.x, I ended up with four rules that made the implementation…
Minecraft player creates death-chest plugin to prevent loss of items upon death. GraveGuard is a death-chest plugin for Paper 1.21.x that drops a protected grave where the player dies, instead of scattering their items into the void. When the player dies, their items and XP are placed in a chest at the death location. A hologram displays a countdown timer for the protection period.
Only the player can open the grave while it's protected, after which it becomes accessible to anyone (or it may despawn, depending on the configuration). A compass is provided to guide the player back to their grave. All settings are customizable in the config.yml file, including protection duration, whether graves despawn, hologram text, and messages.
Existing death-chest plugins either haven't been updated for modern Paper, have complex configuration formats, or silently delete items in edge cases. GraveGuard addresses these issues by searching for a valid grave spot and, if none can be found, dropping the items normally. It includes a restore-on-failure path to avoid silently deleting the player's inventory.
The plugin is MIT-licensed and has a small codebase, making it easy to understand and maintain. It can be downloaded from GitHub (https://github.com/SecondWindMC/GraveGuard) or the PaperMC releases page (https://hangar.papermc.io/SecondWindMC/GraveGuard). The plugin is standalone, with no dependencies. Additionally, a companion plugin called SecondWind adds DBNO (down but not out) revives, allowing teammates to revive downed players and return them to the game.
This plugin is also open source and compatible with Paper 1.21.x (https://github.com/SecondWindMC/SecondWindRevive).
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to
This story
This is one outlet's version. Read the fullest account.