MPromoCodes
适用于 Minecraft 服务器的简单、强大且兼容 Folia 的促销码系统
MPromoCodes 是一个轻量级但灵活的促销码插件,允许玩家通过一个简单的命令兑换奖励代码。 它支持完全可配置的奖励、条件、Discord Webhook 日志、独立的促销码文件以及多种存储类型,包括 YAML、SQLite 和 MySQL。
所有奖励均在 Bukkit、Spigot、Paper、Purpur 和 Folia 服务器上安全执行。
✨ 功能特性
- 使用 /code 兑换促销码
- 促销码存储在单独的 codes.yml 文件中
- 完全可配置的奖励
- 游戏内管理菜单
- 支持 控制台 和 玩家 命令执行
- 使用
message:内置消息系统 - 成功兑换后可选显示 标题 和 副标题 消息
- 每位玩家 独立的代码使用记录
- 一次性代码和多次使用代码
- 全局使用限制
- 每位玩家的使用限制
- 代码冷却支持
- 针对多种不同用例的 20+ 种条件
- 支持 开始日期 和 过期日期 的代码
- 基于权限 的代码访问控制
- 可配置代码输入规则
- 支持 不区分大小写 的代码
- 可配置代码输入的 最小 和 最大 长度
- 对失败兑换尝试的 防垃圾邮件保护
- Discord Webhook 集成
- 成功和失败的兑换 Webhook 日志
/codes webhook test命令- 存储支持:
- YAML
- SQLite
- MySQL
- 自动将旧版
config.yml中的代码迁移到codes.yml - 自动将 YAML 已兑换数据迁移到 SQL 存储
- 使用自定义 TaskManager 进行安全的异步执行
- 兼容 Folia 的执行机制
- 清晰且结构化的配置
? 示例代码配置
促销码现在存储在 codes.yml 中。
codes:
WELCOME:
enabled: true
once-per-player: true
global-use: 3
per-player-use-limit: -1
cooldown: ""
permission-required: ""
start-date: "25/12/2025 00:00"
expiry-date: "31/12/2025 23:59"
title:
enabled: true
main: "&aCode Redeemed!"
sub: "&7You used: &fWELCOME"
fade-in: 10
stay: 40
fade-out: 10
commands:
- "console: give %player% diamond 2"
- "message: &aYou have successfully redeemed the &fWELCOME &acode!"
⚙️ 示例插件设置
通用插件设置存储在 config.yml 中。
settings:
enabled: true
server-name: "survival"
debug: false
case-insensitive-codes: true
trim-code-input: true
min-code-length: 2
max-code-length: 32
use-permission: "mpromocodes.use"
anti-spam:
enabled: true
failed-attempt-cooldown: "3s"
max-failed-attempts: 5
block-time: "1m"
reset-on-success: true
webhook-log-blocked-attempts: true
storage:
type: "SQLITE"
auto-migrate-yaml: true
sqlite:
file: "storage.db"
mysql:
host: "localhost"
port: 3306
database: "mpromocodes"
username: "root"
password: "password"
use-ssl: false
table-prefix: "mpromocodes_"
? Discord Webhook 集成
MPromoCodes 可以将详细日志直接发送到您的 Discord 员工频道。
Webhook 日志可以包含:
- 成功的代码兑换
- 失败的兑换尝试
- 无效的代码
- 已过期的代码
- 已被使用的代码
- 缺少权限
- 达到全局限制
- 未满足条件
您还可以在游戏中直接测试您的 Webhook:
/codes webhook test
Webhook 嵌入支持可配置的颜色、用户名、头像、页脚和提及保护。
? 存储系统
MPromoCodes 支持多种存储后端:
- YAML — 简单的基于文件的存储
- SQLite — 推荐用于大多数单服务器设置
- MySQL — 推荐用于较大的设置和基于数据库的存储
启用时,现有的 redeemed.yml 数据可以自动迁移到 SQLite 或 MySQL。
storage:
type: "SQLITE"
auto-migrate-yaml: true
? 自动迁移
当从旧版本更新时,MPromoCodes 可以自动将现有促销码从 config.yml 移动到新 codes.yml 文件中。
更新后的首次启动时:
- 来自
config.yml的现有codes:被移动到codes.yml - 旧配置文件备份为
config-old.yml - 生成一个新的
config.yml - 现有的已兑换数据可以迁移到 SQLite 或 MySQL
这既保留了旧设置的完整性,又允许插件使用新的更简洁的文件结构。
? 防垃圾邮件保护
MPromoCodes 包含针对失败兑换尝试的内置防垃圾邮件保护。
您可以配置:
- 失败尝试冷却时间
- 最大失败尝试次数
- 临时封禁时间
- 成功兑换后重置
这有助于保护您的服务器和 Discord Webhook 日志免受垃圾邮件困扰。
? 命令
/code <code>- 兑换促销码/codes reload- 重新加载配置和代码文件/codes stats- 显示您已兑换代码的信息/codes menu- 打开管理菜单/codes webhook test- 发送测试 Discord Webhook/codes health- 监控服务器性能、插件加载情况等...
? 权限
mpromocodes.use- 允许玩家兑换代码mpromocodes.admin- 允许管理命令mpromocodes.admin.webhook- 允许测试 Discord Webhooksmpromocodes.admin.health- 允许监控插件
兑换权限也可以在 config.yml 中更改:
settings:
use-permission: "mpromocodes.use"
? 工作原理
促销码在 codes.yml 中定义。
每个代码可以:
- 运行多个奖励
- 执行控制台命令
- 执行玩家命令
- 发送内置插件消息
- 受权限限制
- 具有开始日期
- 具有过期日期
- 每位玩家只能使用一次
- 可以多次使用
- 具有全局使用限制
- 具有每位玩家的使用限制
- 具有冷却时间
- 显示标题和副标题
- 使用高级兑换条件
已兑换的代码数据使用所选的存储类型安全存储。
所有操作均通过安全的调度机制以兼容 Folia 的方式执行。
? 服务器兼容性
✅ Bukkit
✅ Spigot
✅ Paper
✅ Purpur
✅ Folia
✅ Java 17+
? 文件大小说明
此版本的插件 .jar 文件体积较大,因为 MPromoCodes 现已内置支持 SQLite 和 MySQL 数据库。
为了方便服务器管理员设置,所需的数据库驱动程序已直接包含在插件文件中。这意味着您无需单独下载或安装任何用于 SQLite 或 MySQL 支持的额外库。
文件体积增大是正常现象,这是由于捆绑了 SQL 数据库驱动程序所致,尤其是 SQLite 驱动程序,其中包含了针对多种操作系统的原生库。
简而言之:
- 较大的文件体积属于正常情况
- 无需进行额外的安装步骤
- SQLite 和 MySQL 开箱即用
- 仍支持 YAML 存储方式
? 为什么选择 MPromoCodes?
与简单的基于命令的促销码插件不同,MPromoCodes 具备以下优势:
- 采用结构清晰的独立
codes.yml系统 - 支持 Discord Webhook 日志记录
- 支持 YAML、SQLite 和 MySQL 存储方式
- 可自动迁移旧版配置文件及已兑换的数据
- 避免原版命令滥用问题
- 采用兼容 Folia 的安全调度机制
- 保持配置文件的可读性与可维护性
- 非常适合用于活动、奖励、VIP 推广、抽奖以及服务器开服等场景
❤️ 结语
MPromoCodes 的设计兼顾了性能、清晰度以及对未来版本的兼容性。
如果您正在寻找一种具备现代存储方案、Discord 日志记录功能且完全适配 Folia 执行的简洁促销码解决方案——那么就是它了。
? 统计数据
MPromoCodes
Simple, powerful & Folia-ready promo code system for Minecraft servers
MPromoCodes is a lightweight yet flexible promo code plugin that allows players to redeem reward codes using a simple command. It supports fully configurable rewards, conditions, Discord webhook logs, separated promo code files and multiple storage types including YAML, SQLite and MySQL.
All rewards are executed safely on Bukkit, Spigot, Paper, Purpur and Folia servers.
✨ Features
- Redeem promo codes using /code
- Promo codes are stored in a separate codes.yml file
- Fully configurable rewards
- In-Game Admin Menu
- Supports console and player command execution
- Built-in message system using
message: - Optional Title & Subtitle messages after successful redemption
- Per-player code usage
- One-time codes and multi-use codes
- Global use limits
- Per-player use limits
- Code cooldown support
- 20+ Conditions for many different use cases
- Supports start-date and expiry-date codes
- Permission-based code access
- Configurable code input rules
- Case-insensitive code support
- Configurable minimum and maximum code length
- Anti-spam protection for failed redeem attempts
- Discord webhook integration
- Webhook logs for successful and failed redemptions
/codes webhook testcommand- Storage support:
- YAML
- SQLite
- MySQL
- Automatic migration from old
config.ymlcodes tocodes.yml - Automatic migration from YAML redeemed data to SQL storage
- Safe async execution using a custom TaskManager
- Folia-compatible execution
- Clean and organized configuration
? Example Code Configuration
Promo codes are now stored in codes.yml.
codes:
WELCOME:
enabled: true
once-per-player: true
global-use: 3
per-player-use-limit: -1
cooldown: ""
permission-required: ""
start-date: "25/12/2025 00:00"
expiry-date: "31/12/2025 23:59"
title:
enabled: true
main: "&aCode Redeemed!"
sub: "&7You used: &fWELCOME"
fade-in: 10
stay: 40
fade-out: 10
commands:
- "console: give %player% diamond 2"
- "message: &aYou have successfully redeemed the &fWELCOME &acode!"
⚙️ Example Plugin Settings
General plugin settings are stored in config.yml.
settings:
enabled: true
server-name: "survival"
debug: false
case-insensitive-codes: true
trim-code-input: true
min-code-length: 2
max-code-length: 32
use-permission: "mpromocodes.use"
anti-spam:
enabled: true
failed-attempt-cooldown: "3s"
max-failed-attempts: 5
block-time: "1m"
reset-on-success: true
webhook-log-blocked-attempts: true
storage:
type: "SQLITE"
auto-migrate-yaml: true
sqlite:
file: "storage.db"
mysql:
host: "localhost"
port: 3306
database: "mpromocodes"
username: "root"
password: "password"
use-ssl: false
table-prefix: "mpromocodes_"
? Discord Webhook Integration
MPromoCodes can send detailed logs directly to your Discord staff channel.
Webhook logs can include:
- Successful code redemptions
- Failed redemption attempts
- Invalid codes
- Expired codes
- Already used codes
- Missing permissions
- Global limit reached
- Conditions not met
You can also test your webhook directly in-game:
/codes webhook test
Webhook embeds support configurable colors, username, avatar, footer and mention protection.
? Storage System
MPromoCodes supports multiple storage backends:
- YAML — simple file-based storage
- SQLite — recommended for most single-server setups
- MySQL — recommended for larger setups and database-based storage
Existing redeemed.yml data can be automatically migrated to SQLite or MySQL when enabled.
storage:
type: "SQLITE"
auto-migrate-yaml: true
? Automatic Migration
When updating from an older version, MPromoCodes can automatically move existing promo codes from config.yml to the new codes.yml file.
On first startup after updating:
- Existing
codes:fromconfig.ymlare moved tocodes.yml - The old config is backed up as
config-old.yml - A fresh
config.ymlis generated - Existing redeemed data can be migrated to SQLite or MySQL
This keeps old setups safe while allowing the plugin to use the new cleaner file structure.
? Anti-Spam Protection
MPromoCodes includes built-in anti-spam protection for failed redeem attempts.
You can configure:
- Failed attempt cooldown
- Maximum failed attempts
- Temporary block time
- Reset on successful redeem
This helps protect your server and Discord webhook logs from spam.
? Commands
/code <code>- Redeem a promo code/codes reload- Reload configuration and code files/codes stats- Show information about your redeemed codes/codes menu- Opens the Admin Menu/codes webhook test- Sends a test Discord webhook/codes health- Monitor server performance, plugin load and more...
? Permissions
mpromocodes.use- Allows players to redeem codesmpromocodes.admin- Allows admin commandsmpromocodes.admin.webhook- Allows testing Discord webhooksmpromocodes.admin.health- Allows monitoring plugin
The redeem permission can also be changed in config.yml:
settings:
use-permission: "mpromocodes.use"
? How It Works
Promo codes are defined in codes.yml.
Each code can:
- Run multiple rewards
- Execute console commands
- Execute player commands
- Send built-in plugin messages
- Be restricted by permission
- Have a start date
- Have an expiry date
- Be used once per player
- Be used multiple times
- Have global use limits
- Have per-player use limits
- Have cooldowns
- Display a title and subtitle
- Use advanced redeem conditions
Redeemed code data is safely stored using the selected storage type.
All actions are executed in a Folia-safe way using safe scheduling.
? Server Compatibility
✅ Bukkit
✅ Spigot
✅ Paper
✅ Purpur
✅ Folia
✅ Java 17+
? File Size Notice
The plugin .jar file is larger in this version because MPromoCodes now includes built-in SQLite and MySQL database support.
To make setup easier for server owners, the required database drivers are included directly inside the plugin file. This means you do not need to download or install any extra libraries for SQLite or MySQL support.
The increased file size is expected and is caused by the bundled SQL database drivers, especially the SQLite driver, which contains native libraries for multiple operating systems.
In short:
- The larger file size is normal
- No extra installation is required
- SQLite and MySQL work out of the box
- YAML storage is still supported
? Why MPromoCodes?
Unlike simple command-based promo code plugins, MPromoCodes:
- Uses a clean separated
codes.ymlsystem - Supports Discord webhook logging
- Supports YAML, SQLite and MySQL storage
- Can automatically migrate old configs and redeemed data
- Avoids vanilla command abuse
- Works with Folia-safe scheduling
- Keeps configuration readable and maintainable
- Is ideal for events, rewards, VIP promotions, giveaways and server launches
❤️ Final Words
MPromoCodes was built with performance, clarity and future compatibility in mind.
If you are looking for a clean promo code solution with modern storage, Discord logging and Folia-ready execution — this is it.
? Stats
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 MPromoCodes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
本次更新为 MPromoCodes 引入了完整的操作工具包,支持可复用模板、唯一凭证批次、安全恢复、审计及奖励测试。批量任务通过有界后台队列运行,且生成的凭证默认处于禁用状态,使新工作流适用于大型生产服务器。
新增
- 新增存储在
templates.yml中的可复用凭证模板。 - 新增防冲突的唯一凭证代码批量生成功能。
- 新增使用
X占位符配置的凭证掩码。 - 新增默认不含
0/O和1/I/L的可配置无歧义生成字母表。 - 新增每批次限制功能,并附带额外的硬性安全上限。
- 新增
batches.yml中的批次元数据,包括模板、活动、创建者、创建时间、掩码和代码列表。 - 新增对批次的启用、禁用、归档和恢复操作。
- 新增向受保护的
exports目录导出 TXT 和 CSV 格式批次文件的功能。 - 新增按代码名称、批次、模板或活动搜索代码的功能。
- 新增在不删除兑换历史的情况下安全归档和恢复代码的功能。
- 新增基于大小轮转的持久化异步 JSONL 审计日志。
- 新增
/codes audit [page]命令以查看最近的行政管理活动。 - 新增奖励预览,显示类型、启用状态、概率、权重和数值。
- 新增向在线玩家发送奖励测试的功能,且不消耗代码、不更改限制或不启动冷却时间。
- 新增安全的玩家使用/冷却时间及全局使用重置工具。
- 新增对 YAML、SQLite 和 MySQL 存储的重置支持。
- 新增用于凭证操作、审计访问、重置和奖励测试的专用权限。
- 新增所有新命令输出和帮助条目的完整英文和斯洛伐克语本地化。
变更
- 生成的凭证批次默认处于禁用状态,直到管理员审查并启用它们。
- 批量生成、导出和批次修改现在在一个有界的后台工作者上运行。
- 旧的 GUI 删除操作现在改为归档并禁用代码,而不是永久移除其定义。
- 已归档的代码从活跃运行时注册表以及正常/过期/即将推出的 GUI 列表中排除。
- 恢复的代码保持禁用状态,直到管理员显式启用它们。
/codes help现在包含新的感知权限的 1.8 工作流。config-version现已更新为1.8。
改进
- 提高了赠品、创作者活动、一次性购买和外部分发凭证列表的安全性。
- 通过限制排队操作并将大批量磁盘工作移出服务器线程,改进了大型服务器的行为表现。
- 通过归档/恢复和目标重置,改进了从配置错误中恢复的能力。
- 在不将完整生成的凭证列表泄露到审计日志中的情况下,提高了可追溯性。
- 通过将输出路径限制在 MPromoCodes 数据目录内,提高了导出安全性。
- 改进了不区分大小写的冲突检测和掩码验证。
存储与数据安全
- 现有的
codes.yml、campaigns.yml、兑换数据和数据库得以保留。 - 当
templates.yml和batches.yml缺失时会自动创建,并将其视为实时管理员数据。 - 稳定的内部代码 ID 继续在公共代码名称更改时保留历史记录。
- 玩家重置基于稳定的内部 ID 操作,并且只能针对冷却时间或同时针对使用次数和冷却时间。
- SQL 重置在现有的有界存储工作者上执行;玩家重置使用事务。
- 审计条目存储操作元数据和计数,而非每个秘密凭证值。
新命令
/codes template list
/codes template save <template> <code>
/codes template delete <template>
/codes batch list
/codes batch generate <batch> <template> <amount> [mask] [campaign]
/codes batch export <batch> <txt|csv>
/codes batch enable <batch>
/codes batch disable <batch>
/codes batch archive <batch>
/codes batch restore <batch>
/codes search [query] [page]
/codes search --archived [page]
/codes archive <code>
/codes restore <code>
/codes preview <code>
/codes test <code> [online-player]
/codes audit [page]
/codes reset player <player> <code> <usage|cooldown>
/codes reset global <code>
使用 - 可以在提供活动的同时保留默认掩码,例如:
/codes batch generate summer-drop summer-template 250 - summer-2026
新权限
mpromocodes.admin.vouchersmpromocodes.admin.auditmpromocodes.admin.resetmpromocodes.admin.test
上述四项均作为 mpromocodes.admin 的子权限包含在内,并默认赋予服务器操作员。
迁移说明
- 从 1.7/1.7.5 版本升级会触发现有的版本感知配置迁移。
- 旧的
config.yml会被保留为config-old.yml或一个防冲突的版本号/编号备份。 - 新生成的 1.8
config.yml包含完整的operations部分。 - 首次启动后,请将备份中的自定义值复制到新模板中。
- 此模板迁移绝不会替换
codes.yml、campaigns.yml、templates.yml、batches.yml、本地化自定义项和存储数据。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
自定义你的Minecraft头像!
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
评论 0
登录后参与评分
还没有评论,来抢沙发吧