DynamicKeepInv

Dynamically controls keepInventory based on day/night cycle, protection plugins, and death causes.

93

DynamicKeepInv

DynamicKeepInv

Java Server License

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).

Land Integration: bridges this gap by offering a configurable balance: * Land Integration: Players feel safe during the day but must survive the night without protection. * Land Integration: Make PvP high-stakes (drop items) while keeping PvE casual (keep items), or vice-versa. * Land Integration: 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

* Permission Bypass: Configure separate rules for Item Loss and XP Loss based on the killer. * Permission Bypass: Set different rules for the Overworld, Nether, and End. * Permission Bypass: Players with `dynamickeepinv.bypass` never lose items.

Economy & Death GUI

* Persistence: When a player dies, a GUI appears asking them to Persistence: to keep items or Persistence: them. * Persistence: Players can toggle `/dki autopay` to 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. * PlaceholderAPI: Run `/dki stats` to 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

* Folia: Configure rules for "Own Land", "Enemy Land", and "Wilderness". * Folia: Similar support for claims. * Folia: 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):

1. Time-Based (`dynamickeepinv.bypass`) * *If player has this permission, they always keep items.* 2. Time-Based (Lands / GriefPrevention) * *Is the player in their own claim? Use claim settings.* 3. Time-Based (PvP / PvE) * *Did another player kill them? Use PvP settings.* 4. Time-Based * *If enabled, use specific settings for unclaimed land.* 5. Time-Based (Day / Night) * *Fallback: Is it currently Day or Night?*

---

Installation

1. Download the latest JAR from the (Optional) page. 2. Place it into your server's `plugins/` folder. 3. (Optional) Install Vault and an Economy plugin for paid features. 4. 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:

```yaml 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%` - Returns `true` or `false`. * `%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.

``` ```

ADS