mCases
适用于 Paper、Purpur 和 Folia 的可靠奖励宝箱,支持图形界面、方块环绕以及交互式开箱模式。
功能介绍
- 提供可配置的虚拟宝箱及每个宝箱对应的钥匙。
- 在开箱前展示所有已配置的奖励及其精确的基础概率。
- 服务器端在动画播放前即确定奖励;关闭 GUI 不会重新抽取。
- 原子性地消耗钥匙、更新保底计数器,并在 H2 数据库中记录奖励日志。
- 当玩家因崩溃或断线重连时,自动恢复未发放的奖励。
- 支持加权稀有度、可配置保底机制以及控制台命令奖励。
- 通过 Bukkit Services 暴露宝箱定义、概率及钥匙余额数据。
运行环境
- Java 25
- Paper、Purpur 或 Folia 26.3
Vault、mCraft、mBadges、mColor 和 PlaceholderAPI 为可选集成目标。基础插件不依赖它们。
安装
- 将
mCases-1.0.1.jar 放入 plugins 文件夹。
- 启动服务器一次以生成配置文件。
- 编辑
plugins/mCases/cases.yml 并通过 /case reload 重载配置。
奖励命令使用 {player} 和 {uuid} 占位符。仅定义那些确保只执行一次的命令。内置的经济命令仅为示例,且需要兼容的经济命令提供程序。
命令
/case — 列出所有宝箱。
/case <id> — 预览奖励、概率并打开宝箱。
/case key give <player> <case> <amount> — 给予虚拟钥匙。
/case simulate <case> <rolls> — 审计包含保底机制在内的实际概率分布。
/case reload — 验证并重载配置。
权限节点包括 mcases.use、mcases.simulate、mcases.reload 和 mcases.admin。
可靠性模型
一次开箱操作即为一个数据库事务:锁定余额与保底状态、选择奖励、扣除钥匙、更新保底计数,并插入一条未交付的日志记录。仅在事务提交后才会执行相关命令。随后标记该日志记录为已交付。如果玩家先断开连接,则恢复已选定的奖励,而不是重新抽取。
H2 工作负载在专用的虚拟线程上运行,绝不会在主服务器 Tick 线程上执行数据库 I/O。
构建
./gradlew clean build
插件 JAR 文件输出至 build/libs;API 构件输出至 api/build/libs。
本插件采用 MIT 许可证授权。
mCases
Reliable reward cases with GUI, block-orbit, and interactive chest opening modes for Paper, Purpur, and Folia.
What it does
- Provides configurable virtual cases and per-case keys.
- Shows every configured reward and its exact base chance before opening.
- Chooses the reward on the server before animation; closing a GUI cannot reroll it.
- Atomically consumes a key, updates the pity counter and journals the reward in H2.
- Recovers undelivered rewards when a player rejoins after a crash or disconnect.
- Supports weighted rarities, configurable pity and console-command rewards.
- Exposes case definitions, chances and key balances through Bukkit Services.
Requirements
- Java 25
- Paper, Purpur or Folia 26.3
Vault, mCraft, mBadges, mColor and PlaceholderAPI are optional integration targets. The base plugin does not require them.
Install
- Put
mCases-1.0.1.jar in plugins.
- Start the server once.
- Edit
plugins/mCases/cases.yml and reload with /case reload.
Reward commands use {player} and {uuid} placeholders. Define only commands that are safe to execute once. The included economy command is an example and requires a compatible economy command provider.
Commands
/case — list cases.
/case <id> — preview rewards, odds and open a case.
/case key give <player> <case> <amount> — give virtual keys.
/case simulate <case> <rolls> — audit the effective distribution, including pity.
/case reload — validate and reload configuration.
Permissions are mcases.use, mcases.simulate, mcases.reload and mcases.admin.
Reliability model
An opening is one database transaction: lock balance and pity state, select a reward, decrement the key, update pity, and insert an undelivered journal record. Commands run only after that transaction commits. The journal record is marked delivered afterwards. If the player disconnects first, the already selected reward is recovered instead of rolled again.
H2 work runs on a dedicated virtual thread and never performs database I/O on a server tick thread.
Build
./gradlew clean build
The plugin JAR is written to build/libs; API artifacts are written to api/build/libs.
Licensed under the MIT License.
评论 0
登录后参与评分
还没有评论,来抢沙发吧