RedPacket
PluginMIT

RedPacket

A lucky red packet plugin for Paper 1.20.x - 1.21.x servers, built on the Vault economy system.

18
Downloads
0
Followers
1 months ago
Updated
📦
1
Versions

📖About RedPacket

RedPacket - Minecraft Lucky Red Packet Plugin

A lucky red packet plugin for Paper 1.20.x - 1.21.x servers, built on the Vault economy system.

One plugin version supports all compatible servers!

Supported Server Versions

  • ✅ Paper 1.20.1 (API 1.20+)
  • ✅ Paper 1.20.4 (API 1.20+)
  • ✅ Paper 1.20.6 (API 1.20+)
  • ✅ Paper 1.21 (API 1.20+)
  • ✅ Paper 1.21.1 (API 1.20+)
  • ✅ Paper 1.21.11 (API 1.20+)

Features

  1. Red Packet Creation

    • Players can create red packets via commands
    • Customizable quantity, total amount, and duration (max 10 minutes)
    • Automatic balance verification and deduction
  2. Red Packet Grabbing

    • Random amount allocation (lucky grab style)
    • Anti-duplicate grabbing mechanism
    • Real-time balance credit to player's account
  3. Red Packet Management

    • Only one active red packet at a time
    • Automatic expiration handling (auto-settle when expired)
    • Unclaimed amounts automatically returned to creator
  4. Status Query

    • View current red packet status
    • Display remaining quantity, amount, and time
  5. Data Persistence

    • Auto-restore unsettled red packets after server restart
    • Complete logging
  6. Admin Commands

    • Force end and settle current red packet
    • Language switching (Simplified Chinese/English)
    • Detailed statistics and logging
  7. Multi-language Support

    • Supports Simplified Chinese and English
    • Switchable via config file or commands
    • Graceful fallback for missing translations
  8. Multi-version Compatibility

    • Compiled with Paper API 1.20
    • Single plugin version supports all 1.20.x - 1.21.x versions
    • No need to compile different plugins for different versions

Commands

Command Description
/redpacket create <quantity> <amount> <duration(minutes)> Create a red packet
/redpacket grab Grab the red packet
/redpacket status View red packet status
/redpacket end Force end current red packet (Admin)
/redpacket lang <language_code> Switch language (Admin)
/redpacket help Show help message

Aliases: /rp, /redpack

Permissions

Permission Description Default
redpacket.use Use red packet features All players
redpacket.admin Administrator permissions OP

Language Codes

Code Language
zh_CN 简体中文
en_US English

Requirements

  • Paper 1.20.1 or higher (API 1.20+)
  • Vault plugin
  • Any Vault-compatible economy plugin (e.g., EssentialsX, CMI)

Build

Build with Maven:

mvn clean package

The compiled jar will be in the target/ directory.

Configuration

Config files will be generated in plugins/RedPacket/ after plugin startup:

# config.yml
language: en_US         # Default language: zh_CN or en_US
max_duration_minutes: 10 # Maximum red packet duration (minutes)

Multi-version Compatibility

This plugin is compiled with Paper API 1.20, leveraging Paper's backward compatibility:

  1. API Version Declaration: Declare api-version: 1.20 in plugin.yml
  2. Backward Compatibility: Paper servers automatically compatible with plugins compiled with lower API versions
  3. Common API Usage: Plugin only uses common APIs supported by all versions, no version-specific features

This means the same plugin jar can run on:

  • Paper 1.20.x series servers
  • Paper 1.21.x series servers
  • Any future Paper version compatible with API 1.20+

License

This project is licensed under the MIT License.

RedPacket - Minecraft 拼手气红包插件

适用于 Paper 1.20.x - 1.21.x 的拼手气红包插件,基于 Vault 经济系统实现。

一个插件版本即可支持所有兼容服务器!

支持的服务器版本

  • ✅ Paper 1.20.1 (API 1.20+)
  • ✅ Paper 1.20.4 (API 1.20+)
  • ✅ Paper 1.20.6 (API 1.20+)
  • ✅ Paper 1.21 (API 1.20+)
  • ✅ Paper 1.21.1 (API 1.20+)
  • ✅ Paper 1.21.11 (API 1.20+)

功能特性

  1. 红包创建

    • 玩家可通过指令创建红包
    • 支持自定义份数、总金额和持续时间(最长10分钟)
    • 自动验证余额并扣除
  2. 红包抢夺

    • 拼手气随机分配金额
    • 防重复抢夺机制
    • 抢到的金额实时存入玩家账户
  3. 红包管理

    • 同一时间只能存在一个进行中的红包
    • 自动过期处理(到期自动结算)
    • 未领取金额自动返还给创建者
  4. 状态查询

    • 查看当前红包状态
    • 显示剩余份数、金额和时间
  5. 数据持久化

    • 服务器重启后自动恢复未结算的红包
    • 完整的日志记录
  6. 管理员命令

    • 可强制结束并结算当前红包
    • 支持语言切换(简体中文/英文)
    • 详细的统计信息和日志记录
  7. 多语言支持

    • 支持简体中文和英文
    • 可通过配置文件或命令切换语言
    • 缺失文本自动降级处理
  8. 多版本兼容

    • 基于 Paper API 1.20 编译
    • 单个插件版本支持所有 1.20.x - 1.21.x 版本
    • 无需为不同版本编译不同插件

指令

指令 描述
/redpacket create <份数> <总金额> <持续时间(分钟)> 创建红包
/redpacket grab 抢红包
/redpacket status 查看红包状态
/redpacket end 强制结束当前红包(管理员)
/redpacket lang <语言代码> 切换语言(管理员)
/redpacket help 显示帮助信息

别名:/rp, /redpack

权限

权限 描述 默认
redpacket.use 使用红包功能 所有玩家
redpacket.admin 管理员权限 OP

语言代码

代码 语言
zh_CN 简体中文
en_US English

依赖

  • Paper 1.20.1 或更高版本(API 1.20+)
  • Vault 插件
  • 任何 Vault 兼容的经济插件(如 EssentialsX、CMI)

编译

使用 Maven 编译:

mvn clean package

编译后的 jar 文件位于 target/ 目录中。

配置

插件启动后会在 plugins/RedPacket/ 目录下生成配置文件:

# config.yml
language: zh_CN          # 默认语言: zh_CN 或 en_US
max_duration_minutes: 10 # 红包最长持续时间(分钟)

多版本兼容原理

本插件基于 Paper API 1.20 进行编译,利用 Paper 的向后兼容性特性:

  1. API 版本声明plugin.yml 中声明 api-version: 1.20
  2. 向后兼容设计:Paper 服务器会自动兼容使用较低 API 版本编译的插件
  3. 通用 API 使用:插件只使用所有版本都支持的通用 API,不依赖特定版本的新功能

这意味着同一个插件 jar 文件可以在:

  • Paper 1.20.x 系列服务器
  • Paper 1.21.x 系列服务器
  • 任何未来兼容 API 1.20+ 的 Paper 版本

许可证

本项目采用 MIT 许可证。