Playtime
一款轻量级的 Paper 插件,无需 Essentials、Minecraft 统计功能或其他在线时长插件即可追踪玩家的游玩时间。
它追踪哪些内容?
它会分别追踪多种类型的游玩时间:
| 类型 |
描述 |
| 今日 |
当天累计的游玩时间 |
| 本月 |
当月累计的游玩时间 |
| 总计 |
hPlaytime 记录的总游玩时间 |
| 活动 |
具有独立日志的临时游玩时间竞赛 |
本插件从安装时刻开始记录数据。它不会导入 Essentials 的数据,也不使用 Minecraft 自带的统计功能。
命令
玩家
| 命令 |
权限 |
描述 |
/playtime |
hplaytime.use |
查看自己的游玩时间 |
/pt |
hplaytime.use |
/playtime 的别名 |
/playtime <player> |
hplaytime.others |
查看其他玩家的游玩时间 |
/playtime top |
hplaytime.use |
显示历史总游玩时间前 10 名排行榜 |
/playtime topday |
hplaytime.use |
显示日游玩时间前 10 名排行榜 |
/playtime topmonth |
hplaytime.use |
显示月游玩时间前 10 名排行榜 |
管理员
| 命令 |
权限 |
描述 |
/hplaytime reload |
hplaytime.reload |
重载配置文件、语言文件、存储设置、AFK 设置和格式设置 |
/hplaytime reset <player> |
hplaytime.reset |
重置指定玩家的主要游玩时间 |
/hplaytime resetall |
hplaytime.resetall |
重置所有玩家的主要游玩时间 |
活动
| 命令 |
权限 |
描述 |
/playtime event create <name> <duration> |
hplaytime.event.create |
创建一个游玩时间活动 |
/playtime start <name> |
hplaytime.event.start |
启动一个全新的活动 |
/playtime event end <name> |
hplaytime.event.end |
结束一个活动并写入日志 |
/playtime event delete <name> |
hplaytime.event.delete |
删除活动的跟踪文件 |
/event list |
hplaytime.event.list |
列出活动 |
示例:
/playtime event create weekend 24h
/playtime start weekend
支持的时间长度示例:
24h
7d
1h30m
45m
PlaceholderAPI
PlaceholderAPI
如果安装了 PlaceholderAPI,hPlaytime 会自动注册 %hplaytime_...% 占位符。
| 占位符 |
含义 |
%hplaytime_today% |
今日格式化后的游戏时长 |
%hplaytime_month% |
本月格式化后的游戏时长 |
%hplaytime_alltime% |
历史总计格式化后的游戏时长 |
%hplaytime_today_seconds% |
今日游戏时长(整数秒) |
%hplaytime_month_seconds% |
本月游戏时长(整数秒) |
%hplaytime_alltime_seconds% |
历史总计游戏时长(整数秒) |
%hplaytime_today_millis% |
今日游戏时长(毫秒) |
%hplaytime_month_millis% |
本月游戏时长(毫秒) |
%hplaytime_alltime_millis% |
历史总计游戏时长(毫秒) |
%hplaytime_player% |
存储的玩家名称 |
%hplaytime_lastseen% |
“最后上线”文本,显示为 online now(当前在线)或 unknown(未知) |
数字后缀还支持 _minutes、_hours 和 _days。daily 是 today 的别名,monthly 是 month 的别名,total 是 alltime 的别名。
对于 ajLeaderboards,按数值型占位符排序并显示格式化后的值。
| 占位符 |
含义 |
%hplaytime_alltime_seconds% |
用于排序的数值 |
%hplaytime_alltime% |
用于显示的格式化游戏时长 |
也支持直接获取排名靠前的占位符。
| 占位符 |
含义 |
%hplaytime_top_alltime_1_name% |
历史排名第 1 的玩家名称 |
%hplaytime_top_alltime_1_time% |
历史排名第 1 的格式化游戏时长 |
%hplaytime_top_today_1_name% |
今日排名第 1 的玩家名称 |
%hplaytime_top_month_1_time% |
本月排名第 1 的格式化游戏时长 |
顶级排名的占位符格式为 %hplaytime_top_<today|month|alltime>_<rank>_<name|uuid|time|millis|seconds|minutes|hours|days>%。
权限
| 权限 |
默认 |
描述 |
hplaytime.use |
所有人 |
使用 /playtime 命令 |
hplaytime.others |
OP |
查看其他玩家的游戏时长 |
hplaytime.reload |
OP |
重载 hPlaytime |
hplaytime.reset |
OP |
重置单个玩家的主要游戏时长 |
hplaytime.resetall |
OP |
重置所有主要游戏时长 |
hplaytime.event.create |
OP |
创建游戏时长活动 |
hplaytime.event.start |
OP |
开始游戏时长活动 |
hplaytime.event.end |
OP |
结束游戏时长活动 |
hplaytime.event.delete |
OP |
删除活动跟踪文件 |
hplaytime.event.list |
OP |
列出活动 |
功能
- 独立游戏时长追踪
- 每日、每月及历史总计统计
- 临时游戏时长活动
- 默认使用本地 YAML 存储
- 可选 MySQL 存储
- 内置挂机保护
- 不计入游戏时长的挂机世界
- 可选的最后上线信息显示
- 可配置日期、时区和时间格式
- 完全可编辑的
lang.yml
- 玩家与全局重置命令
- 活动获胜者广播
- 永久保存的活动结果日志
- 简单的文本命令,无需 GUI
| 要求 |
版本 |
| 服务器软件 |
Paper 1.19+ |
| Java |
Java 21+ |
MySQL 是可选的。hPlaytime 默认使用本地 YAML 存储。
安装
- 下载最新的 jar 文件。
- 将其放入服务器的
plugins 文件夹中。
- 重启服务器。
- 编辑
plugins/hPlaytime/ 下生成的文件。
- 修改完成后,运行
/hplaytime reload。
插件文件
hPlaytime 会在你服务器的 plugins 目录内创建自己的文件夹。
| 路径 |
用途 |
config.yml |
存储、格式设置、AFK(挂机)、AFK 世界以及保存设置 |
lang.yml |
可编辑的插件消息 |
data/ |
本地玩家游戏时长数据文件 |
events/ |
活跃活动追踪文件 |
event-logs/ |
已保存的活动结果日志 |
存储设置
hPlaytime 支持本地 YAML 存储和 MySQL 存储。
默认启用本地存储:
storage:
type: local
本地玩家数据保存在此处:
plugins/hPlaytime/data/<uuid>.yml
这是最简单的选项,推荐用于单服务器环境。
要使用 MySQL:
storage:
type: mysql
mysql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""
use-ssl: false
table-prefix: hplaytime_
hPlaytime 会自动创建所需的 MySQL 表。
主要游戏时长可以使用 MySQL,但活动追踪目前仍基于本地文件。
AFK(挂机)保护
hPlaytime 包含其自身的 AFK 系统,不依赖 Essentials 的 AFK 功能。
afk:
enabled: true
timeout-seconds: 300
worlds:
- afk
当玩家处于非活跃状态时,新的游戏时长将停止计算,直到他们移动、交互或执行命令为止。
在配置了 AFK 世界的玩家不会获得:
日期、时间和最后上线格式化
日期键和时间区可在 config.yml 中进行配置。
date-format:
timezone: system
daily-pattern: yyyy-MM-dd
monthly-pattern: yyyy-MM
使用 timezone: system 表示使用服务器机器的时区,或使用 Java 时区 ID:
timezone: America/Chicago
时间输出也可以自定义:
time-format:
style: compact
show-seconds: true
zero: 0s
紧凑输出示例:
1d 4h 22m
长格式输出示例:
1 day 4 hours 22 minutes
可以启用、禁用或重新格式化“最后上线”输出:
last-seen:
enabled: true
pattern: yyyy-MM-dd HH:mm:ss z
语言文件
所有消息均可在以下位置编辑:
plugins/hPlaytime/lang.yml
消息支持 & 颜色代码。
常用占位符:
| 占位符 |
描述 |
%prefix% |
lang.yml 中配置的前缀 |
%player% |
玩家名称 |
%today% |
今日游戏时长 |
%month% |
本月游戏时长 |
%alltime% |
累计总游戏时长 |
%lastseen% |
最后上线状态 |
%event% |
活动名称 |
%duration% |
活动持续时间 |
%time% |
格式化后的时间 |
%events% |
活动列表 |
编辑完 lang.yml 后,请运行:
/hplaytime reload
重要说明
- hPlaytime 在安装后即开始追踪游戏时长。
- 它不会导入 Essentials 的游戏时长数据。
- 它不使用 Minecraft 统计数据来计算累计总时长。
- 重置命令仅影响主要游戏时长。
- 重置命令不会删除活动日志。
- AFK 超时适用于主要游戏时长和活动游戏时长。
- AFK 世界适用于主要游戏时长和活动游戏时长。
- 即使活动已删除,活动日志仍会保留。
- 即使启用了 MySQL,活动追踪目前仍基于本地文件。
支持
如果你发现 bug 或有建议,请在 GitHub 上提交 Issue,并提供你的服务器版本、插件版本以及相关控制台错误信息。
该插件正在积极维护中,但新功能的添加会比较谨慎,以保持其轻量级特性。
作者
许可证
Playtime
A lightweight Paper plugin that tracks player playtime without needing Essentials, Minecraft statistics, or another playtime plugin.
What does it track?
It tracks several types of playtime separately:
| Type |
Description |
| Today |
Playtime earned during the current day |
| This Month |
Playtime earned during the current month |
| All-Time |
Total playtime tracked by hPlaytime |
| Events |
Temporary playtime contests with their own logs |
This plugin starts tracking from the moment it is installed. It does not import Essentials data or use Minecraft statistics.
Commands
User
| Command |
Permission |
Description |
/playtime |
hplaytime.use |
Shows your own playtime |
/pt |
hplaytime.use |
Alias for /playtime |
/playtime <player> |
hplaytime.others |
Shows another player's playtime |
/playtime top |
hplaytime.use |
Shows the top 10 all-time playtime leaderboard |
/playtime topday |
hplaytime.use |
Shows the top 10 daily playtime leaderboard |
/playtime topmonth |
hplaytime.use |
Shows the top 10 monthly playtime leaderboard |
Admin
| Command |
Permission |
Description |
/hplaytime reload |
hplaytime.reload |
Reloads config, language, storage settings, AFK settings, and formats |
/hplaytime reset <player> |
hplaytime.reset |
Resets one player' main playtime |
/hplaytime resetall |
hplaytime.resetall |
Resets all players' main playtime |
Events
| Command |
Permission |
Description |
/playtime event create <name> <duration> |
hplaytime.event.create |
Creates a playtime event |
/playtime start <name> |
hplaytime.event.start |
Starts an event fresh |
/playtime event end <name> |
hplaytime.event.end |
Ends an event and writes a log |
/playtime event delete <name> |
hplaytime.event.delete |
Deletes active event tracking files |
/event list |
hplaytime.event.list |
Lists events |
Example:
/playtime event create weekend 24h
/playtime start weekend
Supported duration examples:
24h
7d
1h30m
45m
PlaceholderAPI
PlaceholderAPI
If PlaceholderAPI is installed, hPlaytime registers the %hplaytime_...% placeholders automatically.
| Placeholder |
Meaning |
%hplaytime_today% |
Today's formatted playtime |
%hplaytime_month% |
This month's formatted playtime |
%hplaytime_alltime% |
All-time formatted playtime |
%hplaytime_today_seconds% |
Today's playtime as whole seconds |
%hplaytime_month_seconds% |
This month's playtime as whole seconds |
%hplaytime_alltime_seconds% |
All-time playtime as whole seconds |
%hplaytime_today_millis% |
Today's playtime as milliseconds |
%hplaytime_month_millis% |
This month's playtime as milliseconds |
%hplaytime_alltime_millis% |
All-time playtime as milliseconds |
%hplaytime_player% |
Stored player name |
%hplaytime_lastseen% |
Last-seen text, online now, or unknown |
Numeric suffixes also support _minutes, _hours, and _days. daily is an alias for today, monthly is an alias for month, and total is an alias for alltime.
For ajLeaderboards, sort by a numeric placeholder and display the formatted one.
| Placeholder |
Meaning |
%hplaytime_alltime_seconds% |
Numeric value for sorting |
%hplaytime_alltime% |
Formatted playtime for display |
Direct top placeholders are also available.
| Placeholder |
Meaning |
%hplaytime_top_alltime_1_name% |
Name at all-time rank 1 |
%hplaytime_top_alltime_1_time% |
Formatted all-time playtime at rank 1 |
%hplaytime_top_today_1_name% |
Name at today's rank 1 |
%hplaytime_top_month_1_time% |
Formatted monthly playtime at rank 1 |
The top placeholder format is %hplaytime_top_<today|month|alltime>_<rank>_<name|uuid|time|millis|seconds|minutes|hours|days>%.
Permissions
| Permission |
Default |
Description |
hplaytime.use |
Everyone |
Use /playtime |
hplaytime.others |
OP |
Check another player's playtime |
hplaytime.reload |
OP |
Reload hPlaytime |
hplaytime.reset |
OP |
Reset one player's main playtime |
hplaytime.resetall |
OP |
Reset all main playtime |
hplaytime.event.create |
OP |
Create playtime events |
hplaytime.event.start |
OP |
Start playtime events |
hplaytime.event.end |
OP |
End playtime events |
hplaytime.event.delete |
OP |
Delete event tracking files |
hplaytime.event.list |
OP |
List events |
Features
- Standalone playtime tracking
- Daily, monthly, and all-time totals
- Temporary playtime events
- Local YAML storage by default
- Optional MySQL storage
- Built-in AFK protection
- AFK worlds where playtime does not count
- Optional last-seen display
- Configurable date, timezone, and time formatting
- Fully editable
lang.yml
- Player and global reset commands
- Event winner broadcasts
- Permanent event result logs
- Simple text commands, no GUI required
Requirements
| Requirement |
Version |
| Server Software |
Paper 1.19+ |
| Java |
Java 21+ |
MySQL is optional. hPlaytime uses local YAML storage by default.
Installation
- Download the latest jar.
- Place it inside your server’s
plugins folder.
- Restart your server.
- Edit the generated files in
plugins/hPlaytime/.
- Run
/hplaytime reload after making changes.
Plugin Files
hPlaytime creates its own folder inside your server’s plugins directory.
| Path |
Purpose |
config.yml |
Storage, formatting, AFK, AFK worlds, and save settings |
lang.yml |
Editable plugin messages |
data/ |
Local player playtime files |
events/ |
Active event tracking files |
event-logs/ |
Saved event result logs |
Storage Settings
hPlaytime supports local YAML storage and MySQL.
Local storage is enabled by default:
storage:
type: local
Local player data is saved here:
plugins/hPlaytime/data/<uuid>.yml
This is the simplest option and is recommended for single-server setups.
To use MySQL:
storage:
type: mysql
mysql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""
use-ssl: false
table-prefix: hplaytime_
hPlaytime creates the required MySQL tables automatically.
Main playtime can use MySQL, but event tracking is currently local-file based.
AFK Protection
hPlaytime includes its own AFK system. It does not rely on Essentials AFK.
afk:
enabled: true
timeout-seconds: 300
worlds:
- afk
When a player is inactive, new playtime stops counting until they move, interact, or run a command.
Players in configured AFK worlds do not gain:
- Main playtime
- Event playtime
Date, Time, and Last Seen Formatting
Date keys and timezone are configurable in config.yml.
date-format:
timezone: system
daily-pattern: yyyy-MM-dd
monthly-pattern: yyyy-MM
Use timezone: system for the server machine timezone, or use a Java timezone ID:
timezone: America/Chicago
Time output can also be customized:
time-format:
style: compact
show-seconds: true
zero: 0s
Compact output example:
1d 4h 22m
Long output example:
1 day 4 hours 22 minutes
Last-seen output can be enabled, disabled, or reformatted:
last-seen:
enabled: true
pattern: yyyy-MM-dd HH:mm:ss z
Language File
All messages are editable in:
plugins/hPlaytime/lang.yml
Messages support & color codes.
Common placeholders:
| Placeholder |
Description |
%prefix% |
Configured prefix from lang.yml |
%player% |
Player name |
%today% |
Today's playtime |
%month% |
This month's playtime |
%alltime% |
All-time playtime |
%lastseen% |
Last-seen status |
%event% |
Event name |
%duration% |
Event duration |
%time% |
Formatted time |
%events% |
Event list |
After editing lang.yml, run:
/hplaytime reload
Important Notes
- hPlaytime starts tracking after it is installed.
- It does not import Essentials playtime.
- It does not use Minecraft statistics for all-time totals.
- Reset commands affect main playtime only.
- Reset commands do not delete event logs.
- AFK timeout applies to main playtime and event playtime.
- AFK worlds apply to main playtime and event playtime.
- Event logs are kept even after an event is deleted.
- Event tracking is currently local-file based, even when MySQL is enabled.
Support
If you find a bug or have a suggestion, please open an issue on GitHub with your server version, plugin version, and any relevant console errors.
The plugin is actively maintained, but new features are added carefully to keep it lightweight.
Authors
License
评论 0
登录后参与评分
还没有评论,来抢沙发吧