PlayTimeRewards
一款服务端 Minecraft Forge 模组,根据玩家在服务器上的在线时长给予奖励和/或执行命令。
玩家可在游玩时长里程碑处获得可配置的道具和命令奖励。包含一次性奖励、每小时重复奖励、随机战利品、挂机暂停功能以及当背包已满时的待领取队列。
Side: 仅服务端(客户端无需安装模组即可加入)
特性
- 追踪每位玩家的在线游玩时长,并与世界数据一同保存
- 一次性里程碑奖励与每 N 小时重复奖励
- 发放列表中所有列出的物品,或从列表中随机选取一件物品
- 执行列表中所有列出的控制台命令,或从列表中随机执行一条命令
- 可为奖励物品添加可选的 NBT 标签
- 若玩家背包已满,奖励将进入待领取状态(使用
/rewards claim 领取)
- 可选的 AFK 检测功能,检测到挂机时暂停计时
- 支持使用
& 颜色代码自定义消息
- 仅服务端运行:客户端无需安装
安装
- 为 1.20.1 版本安装 Minecraft Forge。建议使用 47.3.0 或更高版本的 Forge。
- 将 PlayTimeRewards 的 jar 文件放入服务端的
mods 文件夹中。
- 启动服务器一次。默认配置文件将在
config/playtimerewards/ 目录下生成。
- 编辑配置文件并运行
/rewards reload,或者重启服务器。
玩家不需要在客户端安装此模组。
命令
| 命令 |
权限等级 |
描述 |
/rewards |
所有人 |
显示你的游玩时长和待领取奖励 |
/rewards claim |
所有人 |
领取因背包已满而未能获得的待领取奖励 |
/rewards check <player> |
OP 2级 |
查看其他玩家的游玩时长和待领取奖励数量 |
/rewards reload |
OP 2级 |
重新加载 settings.json 和 rewards.json |
/rewards reset <player> |
OP 3级 |
删除指定玩家的已存储游玩时长和奖励进度 |
配置
配置文件位于 config/playtimerewards/ 目录中,并在首次启动时自动生成。
settings.json
| 选项 |
默认值 |
描述 |
playtimeCheckIntervalTicks |
20 |
计算游玩时长的间隔;最小值为 20 tick |
rewardCheckIntervalTicks |
1200 |
检查奖励资格的间隔;最小值为 200 tick |
broadcastRewards |
true |
广播奖励发放通知 |
broadcastMessage |
&a{player} received: {reward}! |
全服奖励广播消息 |
rewardMessage |
&6You earned the {reward} reward for {hours}h of playtime! |
发送给获奖玩家的消息 |
pendingRewardMessage |
&eInventory full! Use /rewards claim to collect. |
当物品无法放入背包时显示的消息 |
afkEnabled |
false |
当玩家闲置时暂停游玩时长计时 |
afkTimeoutMinutes |
5 |
触发 AFK 前的闲置时间(分钟) |
afkMessage |
&7Playtime paused -- you are AFK. |
开始 AFK 时发送的消息 |
afkReturnMessage |
&aWelcome back! Playtime resumed. |
结束 AFK 时发送的消息 |
saveIntervalMinutes |
5 |
保存玩家数据的频率(分钟) |
debug |
false |
启用额外日志记录 |
消息占位符:{player}、{reward}、{hours}、{minutes}。移动、环顾四周、破坏/放置方块、交互或打开容器均可重置 AFK 状态。
rewards.json
每个层级定义一项奖励:
name:唯一的显示名称
requiredHours:阈值,单位为小时
repeating:false 表示一次性里程碑奖励,true 表示每 N 小时重复奖励
items:{ "item": "minecraft:diamond", "count": 1, "nbt": "" } 格式的数组
randomItem:如果为 true,则从列表中随机发放一件物品
commands:控制台命令字符串数组({player} 会被替换)
randomCommand:如果为 true,则从列表中随机执行一条命令
默认层级:新手包(1小时)、每小时随机奖励(每1小时)、老兵奖励(10小时)。
{
"tiers": [
{
"name": "Starter Kit",
"requiredHours": 1.0,
"repeating": false,
"randomItem": false,
"randomCommand": false,
"items": [
{ "item": "minecraft:iron_ingot", "count": 16, "nbt": "" },
{ "item": "minecraft:bread", "count": 32, "nbt": "" }
],
"commands": [
"say {player} has played for 1 hour and received a Starter Kit!"
]
}
]
}
存储
按世界保存的数据存储在 world/playerdata/playtimerewards_playerdata.json 中。
许可证
MIT License (c) 2026 Flurben.
PlayTimeRewards
A server-side Minecraft Forge mod that rewards players and/or executes commands for time spent on your server.
Players earn configurable item and command rewards at playtime milestones. One-time rewards, repeating hourly bonuses, random loot, AFK pause, and a pending-claim queue for full inventories are included.
Side: Server-only (clients can join without the mod)
Features
- Tracks online playtime per player and persists it with the world
- One-time milestone rewards and repeating rewards every N hours
- Give all listed items, or pick one random item
- Run all listed console commands, or pick one random command
- Optional NBT on reward items
- Pending rewards if the player's inventory is full (
/rewards claim)
- Optional AFK detection that pauses playtime
- Configurable messages with
& color codes
- Server-side only: no client install required
Installation
- Install Minecraft Forge for 1.20.1. Forge 47.3.0 or newer is recommended.
- Drop the PlayTimeRewards jar into the server's
mods folder.
- Start the server once. Default configs are created at
config/playtimerewards/.
- Edit the configs and run
/rewards reload, or restart the server.
Players do not need this mod on their client.
Commands
| Command |
Permission |
Description |
/rewards |
Everyone |
Show your playtime and pending rewards |
/rewards claim |
Everyone |
Claim pending rewards that could not fit in your inventory |
/rewards check <player> |
OP level 2 |
View another player's playtime and pending reward count |
/rewards reload |
OP level 2 |
Reload settings.json and rewards.json |
/rewards reset <player> |
OP level 3 |
Delete a player's stored playtime and reward progress |
Configuration
Configs live in config/playtimerewards/ and are generated on first launch.
settings.json
| Option |
Default |
Description |
playtimeCheckIntervalTicks |
20 |
How often playtime is counted; minimum 20 ticks |
rewardCheckIntervalTicks |
1200 |
How often reward eligibility is checked; minimum 200 ticks |
broadcastRewards |
true |
Broadcast when a reward is granted |
broadcastMessage |
&a{player} received: {reward}! |
Server-wide reward message |
rewardMessage |
&6You earned the {reward} reward for {hours}h of playtime! |
Message sent to the rewarded player |
pendingRewardMessage |
&eInventory full! Use /rewards claim to collect. |
Shown when items cannot fit |
afkEnabled |
false |
Pause playtime when a player is idle |
afkTimeoutMinutes |
5 |
Idle time before AFK starts |
afkMessage |
&7Playtime paused -- you are AFK. |
Sent when AFK starts |
afkReturnMessage |
&aWelcome back! Playtime resumed. |
Sent when AFK ends |
saveIntervalMinutes |
5 |
How often player data is saved |
debug |
false |
Extra logging |
Message placeholders: {player}, {reward}, {hours}, {minutes}. AFK is reset by movement, looking around, breaking/placing blocks, interacting, or opening a container.
rewards.json
Each tier defines a reward:
name: unique display name
requiredHours: threshold in hours
repeating: false for one-time milestone, true for every N hours
items: array of { "item": "minecraft:diamond", "count": 1, "nbt": "" }
randomItem: if true, give 1 random item from the list
commands: array of console command strings ({player} is replaced)
randomCommand: if true, run 1 random command from the list
Default tiers: Starter Kit (1h), Hourly Random Bonus (every 1h), Veteran Reward (10h).
{
"tiers": [
{
"name": "Starter Kit",
"requiredHours": 1.0,
"repeating": false,
"randomItem": false,
"randomCommand": false,
"items": [
{ "item": "minecraft:iron_ingot", "count": 16, "nbt": "" },
{ "item": "minecraft:bread", "count": 32, "nbt": "" }
],
"commands": [
"say {player} has played for 1 hour and received a Starter Kit!"
]
}
]
}
Storage
Per-world data is saved to world/playerdata/playtimerewards_playerdata.json.
License
MIT License (c) 2026 Flurben.
评论 0
登录后参与评分
还没有评论,来抢沙发吧