DynamicKeepInv
PluginApache-2.0

DynamicKeepInv

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

45
Downloads
1
Followers
4 months ago
Updated
📦
11
Versions

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

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.bypass never 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 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.
  • In-Game GUI: 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

  • 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):

  1. Bypass Permission (dynamickeepinv.bypass)
    • If player has this permission, they always keep items.
  2. Claim Protection (Lands / GriefPrevention)
    • Is the player in their own claim? Use claim settings.
  3. Death Cause (PvP / PvE)
    • Did another player kill them? Use PvP settings.
  4. Wilderness Settings
    • 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 Releases 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:

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.