DynamicKeepInv
Dynamically controls keepInventory based on day/night cycle, protection plugins, and death causes.
📖About DynamicKeepInv
DynamicKeepInv
DynamicKeepInv is a sophisticated plugin that revolutionizes how the keepInventory gamerule works on Minecraft servers. Instead of a simple global toggle, it dynamically controls inventory loss based on in-game time, death causes, territory protection, and economy.
It is designed for modern servers (1.20.4+) and features full native support for Folia region threading.
Why use DynamicKeepInv?
Vanilla Minecraft forces server administrators to choose between "Too Easy" (keepInventory true) or "Too Hard" (keepInventory false).
DynamicKeepInv bridges this gap by offering a configurable balance:
- Day/Night Cycle: Players feel safe during the day but must survive the night without protection.
- PvP vs PvE: Make PvP high-stakes (drop items) while keeping PvE casual (keep items), or vice-versa.
- Economy Sink: Allow players to pay a fee to save their items upon death via an interactive GUI.
- Land Integration: Respects claims from Lands and GriefPrevention (e.g., keep items in your own base).
Key Features
Time-Based Rules
- Automatically enables keepInventory during the day.
- Disables it at night based on configurable start and end ticks.
- Plays sounds and sends titles when the status changes.
Advanced Death Rules
- PvP vs PvE: Configure separate rules for Item Loss and XP Loss based on the killer.
- By World: Set different rules for the Overworld, Nether, and End.
- Permission Bypass: Players with
dynamickeepinv.bypassnever lose items.
Economy & Death GUI
- Death Confirmation GUI: When a player dies, a GUI appears asking them to PAY to keep items or DROP them.
- Auto-Pay: Players can toggle
/dki autopayto automatically deduct the fee and skip the GUI. - Persistence: If a player disconnects while dead, their pending death is saved to a database and the GUI reopens upon rejoin.
- (Requires Vault)
Player Statistics
- Tracks death history for every player.
- In-Game GUI: Run
/dki statsto view:- Total Deaths, Saved Deaths, and Lost Deaths.
- Money spent on keeping inventory.
- Death cause breakdown (Day, Night, PvP, etc.).
- PlaceholderAPI: Display these stats on scoreboards or chat.
Plugin Integrations
- Lands: Configure rules for "Own Land", "Enemy Land", and "Wilderness".
- GriefPrevention: Similar support for claims.
- GravesX / AxGraves: If a player chooses to drop items (or cannot afford to pay), they are placed into a Grave instead of scattering on the ground.
- Folia: 100% thread-safe region scheduling.
Logic Hierarchy
When a player dies, the plugin decides whether to keep or drop items based on this priority order (highest to lowest):
- Bypass Permission (
dynamickeepinv.bypass)- If player has this permission, they always keep items.
- Claim Protection (Lands / GriefPrevention)
- Is the player in their own claim? Use claim settings.
- Death Cause (PvP / PvE)
- Did another player kill them? Use PvP settings.
- Wilderness Settings
- If enabled, use specific settings for unclaimed land.
- Time-Based (Day / Night)
- Fallback: Is it currently Day or Night?
Installation
- Download the latest JAR from the Releases page.
- Place it into your server's
plugins/folder. - (Optional) Install Vault and an Economy plugin for paid features.
- Restart the server.
Commands & Permissions
| Command | Permission | Description |
|---|---|---|
/dki status |
dynamickeepinv.admin |
View current status (Time, World, Enabled). |
/dki reload |
dynamickeepinv.admin |
Reload configuration and messages. |
/dki toggle |
dynamickeepinv.admin |
Toggle the plugin on/off globally. |
/dki stats [player] |
dynamickeepinv.stats |
View death statistics GUI. |
/dki confirm |
dynamickeepinv.use |
Re-open the Death Confirmation GUI (if pending). |
/dki autopay |
dynamickeepinv.use |
Toggle auto-payment mode. |
Other Permissions:
dynamickeepinv.bypass: User always keeps inventory.dynamickeepinv.stats.others: View other players' stats.
Configuration
A snippet of config.yml demonstrating the advanced economy mode:
advanced:
enabled: true
# Economy Settings
economy:
enabled: true
cost: 100.0
mode: "gui" # Options: charge-to-keep, charge-to-bypass, gui
gui:
timeout: 30 # Seconds to decide
expire-time: 300 # Seconds to save data on disconnect
# Death Cause Rules
death-cause:
enabled: true
pvp:
keep-items: false
keep-xp: false
pve:
keep-items: true
keep-xp: true
Placeholders
Requires PlaceholderAPI.
%dynamickeepinv_isday%- Returnstrueorfalse.%dynamickeepinv_period%- Returns "Day" or "Night".%dynamickeepinv_stats_save_rate%- Player's save percentage.%dynamickeepinv_economy_cost%- Current death cost.
License
This project is licensed under the Apache 2.0 License.