DynamicKeepInv
DynamicKeepInv 是一款先进的插件,彻底革新了 Minecraft 服务器中 keepInventory(死亡不掉落)游戏规则的运作方式。它不仅仅是一个简单的全局开关,而是根据游戏内时间、死亡原因、领地保护以及经济系统来动态控制物品掉落。
它专为现代服务器(1.20.4+)设计,并完全原生支持 Folia 区域线程调度。
为什么要使用 DynamicKeepInv?
原版 Minecraft 迫使服务器管理员在“太简单”(keepInventory true)和“太难”(keepInventory false)之间做出选择。
DynamicKeepInv 通过提供可配置的平衡方案填补了这一空白:
- 昼夜循环: 玩家在白天感到安全,但必须在没有保护的情况下度过夜晚。
- PvP 与 PvE: 使 PvP 具有高赌注(掉落物品),同时保持 PvE 休闲(保留物品),或者反之。
- 经济回收: 允许玩家通过交互式 GUI 支付费用,在死亡时保存其物品。
- 领地集成: 尊重 Lands 和 GriefPrevention 的领地声明(例如,在自己的基地内保留物品)。
主要功能
基于时间的规则
- 自动在白天启用 keepInventory。
- 根据可配置的开始和结束刻数,在夜间禁用该规则。
- 在状态改变时播放音效并发送标题栏提示。
高级死亡规则
- PvP vs PvE: 根据击杀者类型配置独立的物品掉落和经验值掉落规则。
- 按世界设置: 为主世界、下界和末地设置不同的规则。
- 权限绕过: 拥有
dynamickeepinv.bypass 权限的玩家永远不会丢失物品。
经济与死亡 GUI
- 死亡确认 GUI: 当玩家死亡时,会出现一个 GUI,询问他们是支付费用以保留物品还是丢弃物品。
- 自动支付: 玩家可以切换
/dki autopay 命令,自动扣除费用并跳过 GUI。
- 持久化: 如果玩家在死亡状态下断开连接,其待处理的死亡记录会保存到数据库中,并在重新加入时重新打开 GUI。
- (需要 Vault)
玩家统计
- 追踪每位玩家的死亡历史。
- 游戏内 GUI: 运行
/dki stats 查看:
- 总死亡次数、保存次数和丢失次数。
- 用于保留物品的金钱花费。
- 死亡原因细分(白天、夜晚、PvP 等)。
- PlaceholderAPI: 在记分板或聊天中显示这些统计数据。
插件集成
- Lands: 配置针对“自己的领地”、“敌方领地”和“荒野”的规则。
- GriefPrevention: 提供类似的领地声明支持。
- GravesX / AxGraves: 如果玩家选择丢弃物品(或无力支付),物品将被放入坟墓中,而不是散落在地面上。
- Folia: 100% 线程安全的区域调度。
逻辑层级
当玩家死亡时,插件会根据以下优先级顺序决定是保留还是丢弃物品(优先级从高到低):
- 绕过权限 (
dynamickeepinv.bypass)
- 领地保护 (Lands / GriefPrevention)
- 死亡原因 (PvP / PvE)
- 荒野设置
- 基于时间 (白天 / 夜晚)
安装
- 从 Releases 页面下载最新的 JAR 文件。
- 将其放入服务器的
plugins/ 文件夹中。
- (可选) 安装 Vault 和经济类插件以启用付费功能。
- 重启服务器。
命令与权限
| 命令 |
权限 |
描述 |
/dki status |
dynamickeepinv.admin |
查看当前状态(时间、世界、启用状态)。 |
/dki reload |
dynamickeepinv.admin |
重新加载配置和消息。 |
/dki toggle |
dynamickeepinv.admin |
全局开启或关闭插件。 |
/dki stats [player] |
dynamickeepinv.stats |
查看死亡统计数据 GUI。 |
/dki confirm |
dynamickeepinv.use |
重新打开死亡确认 GUI(如果有待处理项)。 |
/dki autopay |
dynamickeepinv.use |
切换自动支付模式。 |
其他权限:
dynamickeepinv.bypass: 用户始终保留物品栏。
dynamickeepinv.stats.others: 查看其他玩家的统计数据。
配置
以下是展示高级经济模式的 config.yml 片段:
advanced:
enabled: true
# 经济设置
economy:
enabled: true
cost: 100.0
mode: "gui" # 选项: charge-to-keep, charge-to-bypass, gui
gui:
timeout: 30 # 决策秒数
expire-time: 300 # 断开连接时保存数据的秒数
# 死亡原因规则
death-cause:
enabled: true
pvp:
keep-items: false
keep-xp: false
pve:
keep-items: true
keep-xp: true
占位符
需要 PlaceholderAPI。
%dynamickeepinv_isday% - 返回 true 或 false。
%dynamickeepinv_period% - 返回 "Day" 或 "Night"。
%dynamickeepinv_stats_save_rate% - 玩家的保存百分比。
%dynamickeepinv_economy_cost% - 当前的死亡费用。
许可证
本项目遵循 Apache 2.0 许可证。
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.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):
- 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% - 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.
评论 0
登录后参与评分
还没有评论,来抢沙发吧