DailyRewards
一个无依赖的每日奖励插件。玩家运行 /daily 领取奖励,在冷却时间(cooldown)内每人仅可领取一次,奖励从配置的奖池中随机抽取。奖励可以给予物品和/或执行控制台命令,因此金钱、宝箱钥匙、权限组以及其他任何内容都可以通过你已安装的其他插件发放——DailyRewards 无需依赖 Vault 或任何经济类库。
核心理念:旧的每日奖励插件因运行时依赖损坏而失效。本插件拥有零外部/运行时依赖——它仅使用 Bukkit API。没有任何东西会出错。
功能说明
/daily 在每次冷却后(默认 24 小时)领取一次奖励。
- 奖励通过
weighted-random(加权随机,默认)、random(纯随机)或 all(全部获取)模式选取。
- 每个奖励均可给予物品、执行控制台命令(支持
{player} 占位符)以及显示消息——任意组合。
- 冷却状态按玩家 UUID 持久化存储在
cooldowns.yml 中,重启后保留。
- 如果玩家背包已满,溢出物品将掉落在其脚下(配置项可改为拒绝领取)。
为何不依赖经济系统
与其在编译时调用 Vault 或经济 API,奖励条目可以列出控制台命令。想要给予 500 金币?在该奖励的 commands 中添加 "eco give {player} 500"。想要给予宝箱钥匙?使用 "crate give {player} vote 1"。DailyRewards 仅以控制台身份分发命令;它不关心也不知晓哪个插件处理该命令,即使缺少该插件也不会导致加载失败(命令将在控制台中报错并被记录)。
命令
所有命令均基于 /daily(别名:/dailyreward, /dailyrewards)。
| 命令 |
描述 |
/daily |
领取你的每日奖励。 |
/daily give <player> [--force] |
强制玩家领取。可在控制台和命令方块中运行。--force 绕过冷却检查(且不会消耗玩家实际的计时器)。 |
/daily reload |
重载 config.yml。 |
/daily reset <player> |
清除玩家的冷却状态。 |
Tab 补全支持子命令、在线玩家名称以及 --force 参数。
控制台与自动化
/daily give <player> 专为从服务器控制台和命令方块运行而设计,因此调度器或 Geyser 设置中的回归逻辑均可用于发放奖励。目标玩家必须处于在线状态(物品发放和 {player} 命令需要活跃的玩家实体)。--force 跳过冷却检查。
通过 Geyser 连接的基岩版玩家像其他玩家一样运行 /daily——没有特殊处理。
权限
| 权限节点 |
默认值 |
授予权限 |
dailyrewards.use |
true |
使用 /daily 领取奖励。 |
dailyrewards.admin |
op |
使用 give、reload、reset(包含 dailyrewards.use)。 |
控制台始终通过权限检查,因此 give/reload/reset 开箱即用,可直接从控制台和命令方块运行。
配置文件 (config.yml)
| 键 (Key) |
默认值 |
含义 |
cooldown-seconds |
86400 |
每位玩家两次领取之间的秒数。 |
reward-mode |
weighted-random |
weighted-random(加权随机)、random(纯随机)或 all(全部获取)。 |
overflow |
drop |
溢出物品掉落在玩家脚下 (drop),或直接拒绝 (deny)。 |
rewards |
(示例奖池) |
奖励奖池——详见下文。 |
messages.* |
(默认值) |
所有面向玩家的字符串。 |
奖励条目结构
rewards:
- id: rare-gem # 标识符(用于日志记录)
weight: 9 # 加权随机选择权重(数值越高 = 概率越大)
items: # 可选的物品列表
- material: DIAMOND # Bukkit 材质名称;无效名称将被记录并跳过
amount: 2
name: "&bLucky Diamond" # 可选,支持 & 颜色代码
lore: # 可选
- "&7A rare find."
commands: # 可选的控制台命令;{player} = 领取者的名字
- "say {player} found a gem!"
message: "&bDaily reward: a rare gem!" # 可选的聊天消息行
weight 仅在 weighted-random 模式下生效。单条目奖池始终返回该条目;如果所有权重均为 0,插件将回退到均匀随机选择,以确保奖池仍能发放奖励。
消息
支持 & 颜色代码。占位符:{time}(人类可读的剩余冷却时间,如 5h 12m 3s)和 {player}。
相关消息键包括:prefix、cooldown、claimed、no-reward、overflow-dropped、overflow-denied。
兼容性
Paper / Spigot / Bukkit / Purpur,Minecraft 1.21.1-1.21.11。单个 jar 文件,基于 1.21.1 API 构建(Java 21,class 65),已在 Paper 1.21.11 上完成加载测试;不包含仅限 Paper 的类,不涉及 NMS,无任何依赖。
已知局限 / 诚实声明
- 未在真实客户端/服务器环境中进行游玩测试——此构建环境中没有 Minecraft 客户端。插件编译清晰,jar 包内含有效的
plugin.yml(版本 1.0.0),且每个类均为 Java-21 字节码(class 65),但游戏内的行为尚未经过人工验证。
/daily give 和物品发放要求目标玩家在线。不支持排队/离线交付——对于离线目标,系统将报告错误而非将其加入队列。
/daily reset 通过服务器的离线玩家缓存解析离线玩家,该缓存仅包含曾经加入过的玩家。
- 奖励相关的控制台命令采用“发后即忘”(fire-and-forget)机制;DailyRewards 不会检查下游插件是否实际成功(仅捕获并记录异常)。这是为了保持无依赖设计而有意为之。
原始概念由 Reddit (r/Minecraft) 上的 u/DiamondKing1437 提出。由 BeansNToast 开发。
DailyRewards
A dependency-FREE daily reward plugin. Players run /daily to claim, once per
cooldown, a reward picked from a configured pool. Rewards grant items and/or run
console commands, so money, crate keys, ranks, and anything else are handed out
through whatever other plugin you already run - without DailyRewards depending
on Vault or any economy library.
The point: an old daily-reward plugin died when a runtime dependency rotted.
This one has zero external/runtime dependencies - it uses only the Bukkit
API. Nothing to break.
What it does
/daily claims a reward once per cooldown (default 24 hours).
- The reward is chosen by
weighted-random (default), random, or all.
- Each reward can give items, run console commands (with a
{player}
placeholder), and show a message - any combination.
- Cooldowns persist per player UUID in
cooldowns.yml across restarts.
- If a player's inventory is full, overflow items are dropped at their feet
(configurable to deny instead).
Why no economy dependency
Instead of calling Vault or an economy API at compile time, reward entries can
list console commands. Want to pay 500 coins? Add
"eco give {player} 500" to that reward's commands. Want to give a crate key?
"crate give {player} vote 1". DailyRewards just dispatches the command as the
console - it does not know or care which plugin handles it, and it will not fail
to load if that plugin is missing (the command simply errors in console and is
logged).
Commands
All under /daily (aliases: /dailyreward, /dailyrewards).
| Command |
Description |
/daily |
Claim your daily reward. |
/daily give <player> [--force] |
Make a player claim. Runnable from console and command blocks. --force bypasses the cooldown (and does NOT consume the player's real timer). |
/daily reload |
Reload config.yml. |
/daily reset <player> |
Clear a player's cooldown. |
Tab-completion covers subcommands, online player names, and --force.
Console and automation
/daily give <player> is built to run from the server console and from command
blocks, so a scheduler or a returning Geyser setup can hand out rewards. The
target player must be online (items and {player} commands need a live player).
--force skips the cooldown check.
Bedrock players via Geyser just run /daily like everyone else - there is no
special handling.
Permissions
| Permission |
Default |
Grants |
dailyrewards.use |
true |
Claim with /daily. |
dailyrewards.admin |
op |
give, reload, reset (includes dailyrewards.use). |
The console always passes permission checks, so give/reload/reset work
from console and command blocks out of the box.
Configuration (config.yml)
| Key |
Default |
Meaning |
cooldown-seconds |
86400 |
Seconds between claims per player. |
reward-mode |
weighted-random |
weighted-random, random, or all. |
overflow |
drop |
drop overflow at the player's feet, or deny (skip) it. |
rewards |
(sample pool) |
The reward pool - see below. |
messages.* |
(defaults) |
All player-facing strings. |
A reward entry
rewards:
- id: rare-gem # identifier (used in logs)
weight: 9 # selection weight for weighted-random (higher = likelier)
items: # optional list of items to give
- material: DIAMOND # Bukkit material name; invalid names are logged + skipped
amount: 2
name: "&bLucky Diamond" # optional, supports & colour codes
lore: # optional
- "&7A rare find."
commands: # optional console commands; {player} = claimer's name
- "say {player} found a gem!"
message: "&bDaily reward: a rare gem!" # optional chat line
weight is only used by weighted-random. A single-entry pool always returns
that entry; if all weights are 0 the plugin falls back to a uniform pick so the
pool still pays out.
Messages
Supports & colour codes. Placeholders: {time} (human-readable remaining
cooldown like 5h 12m 3s) and {player}.
prefix, cooldown, claimed, no-reward, overflow-dropped,
overflow-denied.
Compatibility
Paper / Spigot / Bukkit / Purpur, Minecraft 1.21.1-1.21.11. One jar, built
against the 1.21.1 API (Java 21, class 65), load-tested on Paper 1.21.11; no
Paper-only classes, no NMS, no dependencies.
Known gaps / honesty
- Not playtested in a live client/server - there is no Minecraft client in
this build environment. The plugin compiles cleanly, the jar bundles a valid
plugin.yml (version 1.0.0), and every class is Java-21 bytecode (class 65),
but in-game behaviour has not been verified by hand.
/daily give and the item grant require the target to be online. There is
no queued/offline delivery - an offline target is reported, not queued.
/daily reset resolves offline players via the server's offline-player cache,
which only knows players who have joined before.
- Reward console commands are fire-and-forget; DailyRewards does not check
whether the downstream plugin actually succeeded (it only catches and logs
exceptions). This is by design to keep it dependency-free.
Original concept by u/DiamondKing1437 on Reddit (r/Minecraft). Built by BeansNToast.
评论 0
登录后参与评分
还没有评论,来抢沙发吧