MacTime

插件

· 作者 ajmac

只有正确追踪时间,才能有效管理时间。 一款对管理员友好的插件,用于追踪服务器上工作人员的在线时间。

0 本站下载 0 关注 更新于 3 个月前

最新 1.1.9 · 1.21.11 · Bukkit / Folia

一键开服(送7天)

MacTime

此插件用于追踪玩家的在线时长。

功能

  • 唯一更新至最新 Minecraft 版本的在线时长追踪插件
  • 几乎所有消息均可通过 messages.yml 进行配置
  • GUI 展示玩家的各种在线时长数据(实时更新,间隔可配置)(适用于 1.21.0 至 1.21.11)
  • 在单实例运行且拥有超过 500 名玩家、同时追踪超过 50 名管理人员的情况下,线程占用率为 0% (通过 spark)
  • MySQL 支持
  • Folia 支持
  • 管理员友好的命令、权限节点和错误信息,便于定位问题
  • Discord Webhook 支持
  • 除 /mactime gui 外,所有命令均可由控制台执行
  • 可配置的消息支持 Hex 颜色代码
  • PlaceholderAPI 支持
  • AFK 时间追踪(配合 EssentialsX)

命令

管理员命令

  • /mactime export <all:player> [username]
    • 如果启用了 Discord Webhooks,此命令允许你导出特定玩家或所有被追踪玩家的在线时长数据。
  • /mactime gui [groupname:online:offline:other] 此命令仅适用于运行 Minecraft 版本为 1.21.0 至 1.21.11 的服务器
    • 打开一个 GUI,展示所有玩家的在线时长数据。如果你的服务器安装了 LuckPerms,你可以按组权重对 GUI 中的玩家进行排序。
    • 你还可以设置 GUI 的实时更新时间间隔(如果不希望更新,请在 config.yml 中将 gui.updateinterval 设置为 0)。
    • 如果你想查看特定组中玩家的在线时长,可以在 gui.whitelisted-groups 下指定包含的组,然后运行 /mactime gui [groupname]。
    • 你还可以通过运行 /mactime gui [online:offline] 来分别查看在线或离线玩家的数据。
    • 如果一名玩家之前属于 gui.whitelisted-groups 中指定的组,但现在不再属于该组,你可以通过运行 /mactime gui [other] 查看其数据。
      (如果你希望在玩家下次加入服务器时,若其不再拥有 mactime.track 权限节点则清除其数据,可在 config.yml 中启用 other.remove-if-no-perm。)
  • /mactime help
    • 显示帮助菜单
  • /mactime reload [config:messages]
    • 重新加载 config.yml 文件或 messages.yml 文件。如果未指定选项,则两者都会重新加载。
  • /mactime reset <player:group> <groupname:username>
    • 重置玩家或组(如果你的服务器安装了 LuckPerms)的在线时长数据。
    • 如果你希望在运行此命令后永久从服务器中删除用户数据,可以在 config.yml 中将 reset.delete-data-on-reset 设置为 true。
  • /ontime <username>
    • 查看特定玩家的在线时长数据

玩家命令

  • /ontime
    • 根据玩家的权限显示在线时长数据。

权限

权限 说明
mactime.* 授予所有权限。
ontime.track 允许插件追踪玩家的游戏时间。
mactime.admin 提供对 /mactime 命令的访问权限。
mactime.command.* 提供对所有 /mactime 命令及其子命令的访问权限。
mactime.command.help 授予对 /mactime help 的访问权限。

|mactime.command.reload| 授予使用 /mactime reload [config:messages] 命令的权限。| |mactime.command.export| 如果启用了 Discord Webhook,此权限允许你将玩家的在线时长数据导出到 Webhook。| |mactime.command.reset| 授予使用 /mactime reset 命令的权限。|

|mactime.command.gui| 授予对 /mactime gui 命令的访问权限。| |ontime.own| 允许使用 /ontime 命令。| |ontime.own.*| 提供查看所有在线统计数据的权限。| |ontime.own.afk| 提供通过 /ontime 查看空闲时间的权限。| |ontime.own.daily| 提供通过 /ontime 查看每日时长的权限。| |ontime.own.weekly| 提供通过 /ontime 查看每周时长的权限。|

|ontime.own.monthly| 允许通过 /ontime 查看每月游戏时间。| |ontime.own.yearly| 允许通过 /ontime 查看每年游戏时间。| |ontime.own.alltime| 允许通过 /ontime 查看累计总游戏时间。| |ontime.others| 允许使用 /ontime <用户名> 查看其他玩家的游戏时长。|

|ontime.others.*| 允许查看所有其他玩家的准时统计数据。 |

|ontime.others.afk| 允许通过 /ontime 查看其他玩家的挂机时间。 | |ontime.others.daily| 允许通过 /ontime 查看其他玩家的每日在线时长。 | |ontime.others.weekly| 允许通过 /ontime 查看其他玩家的每周在线时长。 | |ontime.others.monthly| 允许通过 /ontime 查看其他玩家的每月在线时长。 | |ontime.others.yearly| 允许通过 /ontime 查看其他玩家的每年在线时长。 | |ontime.others.alltime| 允许通过 /ontime 查看其他玩家的总在线时长。 |

占位符

权限 描述
%mactime_current% 显示查看该占位符的用户的当前在线时长
%mactime_daily% 显示查看该占位符的用户的每日在线时长
%mactime_weekly% 显示查看该占位符的用户的每周在线时长
%mactime_monthly% 显示查看该占位符的用户的每月在线时长
%mactime_yearly% 显示查看该占位符的用户年度在线时长
%mactime_alltime% 显示查看该占位符的用户累计在线时长
%mactime_afktime% 显示查看该占位符的用户挂机时长
%mactime_lastonline% 始终返回 Player is currently online!(玩家当前在线!)

对于其他玩家,你可以在占位符末尾添加他们的用户名。
例如,

  • %mactime_daily_notch%
    • 这将返回玩家 “Notch” 的每日在线时长。
      如果指定玩家没有数据,则该占位符将显示 Player has no data.
      对于 %mactime_lastonline_notch%,它将返回该玩家自离线以来经过的时间。

如果需要以秒为单位的原始数值,可以在任何与时间相关的占位符末尾添加 _raw。 例如,

  • %mactime_daily_raw%
    • 如果你每天在线时长为 5 分钟,这将返回 300

Hooks(钩子)

此插件通过 3 个插件提供可选功能


  • Luckperms
    • MacTime 接入 Luckperms 以实现按权重对组进行排序,并在 GUI 中添加玩家的前缀
  • EssentialsX
    • 用于启用空闲 (AFK) 时间的追踪
  • PlaceholderAPI
    • 用于占位符。

展示

GUI

mactime_gui_example

Ontime 命令

mactime_ontime_command_example

Discord Webhook

discord_webhook

Placeholders(占位符)

mactime_placeholders_example

默认 config.yml
# MacTime, by AjMaacc

# Storage options
# Data is stored in plugins/MacTime/playerdata/mactime.db
# Default storage type is SQLite

sql:
  # To use MySQL, set below to true
  # Default: false
  enabled: false
  # Your database's server address
  address: '127.0.0.1:3306'

  # Database name, username and password.
  database: ""
  username: ""
  password: ""

  # options
  usessl: false

# At the end of every week you can save players ontimes to a file in leaderboard fashion
ontime-saving:

  # Toggle this feature on/off
  # Default: true
  enabled: true

  # Day of the week ontime will be saved
  # Options: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
  # Default: Monday
  dayofweek: 'Monday'

  # Order of which times will sort by
  # Options: Alphabetical, Ascending, Descending, Group.
  # Group will sort by Luckperms group, requires Luckperms to be installed!
  # Default: Descending
  order: "Descending"

# MacTime Admin Command Configurations

# Reset
# Options for the /mactime reset command
reset:
  # Delay before any un-confirmed /mactime reset queries are cancelled in seconds
  # Default: 10
  delay: 10

  # Removes data entirely versus restarting the count after reset
  # Default: false
  delete-data-on-reset: false

  # Sets who is able to use /mactime reset * (resets everyone's ontime)
  # Options: "None", "Console", "Player", "All"
  # Default: None
  wildcard-reset: 'None'

# AFK Checker
# The AFK Status of a player is determined by MacTime hooking into Essentials.
# You will need to have essentials on your server for this to work.
afk-checker:
  # Enable AFK time tracking
  # Default: false
  enabled: false

luckperms:
  # Luckperm groups to be included for sorting by groups
  # You must have Luckperms installed for this to be relevant
  # Default:
  #  - owner
  #  - manager
  #  - admin
  #  - jradmin
  #  - dev
  #  - srmod
  #  - mod
  #  - jrmod
  #  - helper
  whitelisted-groups:
    - owner
    - manager
    - admin
    - jradmin
    - dev
    - srmod
    - mod
    - jrmod
    - helper

# GUI
# Options for the /mactime gui command
gui:
  # Sorts /mactime gui by Luckperm groups specified under "luckpermgroups"
  # You need to have Luckperms on your server for this to work!
  # Default: false
  sort-by-luckperm-group: false

  # Duration in seconds to update the gui
  # Set this to 0 to disable this feature
  # Default: 10
  update-interval: 10

# Discord Webhooks
webhook:
  # Enable this feature
  # Default: false
  enabled: false
  # Webhook url
  url: ''
  # Username for the webhook. If this is not set (or empty), this will default to "MacTime"
  username: ''

  join:
    # Enables player join webhooks to be sent
    # Default: true
    enabled: true
    # If you want this specific embed to be sent to a separate webhook,
    # add the secondary webhook's url here
    # If left empty, this defaults to use the main webhook url defined under "webhook.url"
    url: ''
    # If you would like the webhook's username to differ from the original username (webhook.username)
    # Leaving this blank defaults to webhook.username
    username: ''

  leave:
    # Enables player leave webhooks to be sent
    # Default: true
    enabled: true
    url: ''
    username: ''

  afkstart:
    # Enables webhooks to be sent for when a player goes afk
    # Default: true
    enabled: true
    url: ''
    username: ''

  afkend:
    # Enables webhooks to be sent when a player returns from being afk
    # Default: true
    enabled: true
    url: ''
    username: ''

  print:
    # Enables the "/mactime export" command and allows playerdata to be sent by the webhook
    # Default: true
    enabled: true
    url: ''
    username: ''

  saving:
    # Enables weekly data saved during the ontime-saving section to be sent by the webhook
    # Default: true
    enabled: true
    url: ''
    username: ''

other:
  # Enables the beautiful MacTime signature in console on startup
  # If you don't want this, set below to false
  # Default: true
  signature: true

  # Removes a player's ontime data if they are no longer have the `ontime.track` permission
  # This deletes their data on the player's next join
  # Default: false
  remove-if-no-perm: false

  # Your timezone
  # Use https://pastebin.com/mfdYhnu7 to find the format for your timezone
  timezone: "America/New_York"

# Date of when ontime first started recording
# This resets when you do /mactime reset *
# Don't touch pls
start: ''

# Config version (don't touch or u get malaria)
version: '1.0.4'
默认 messages.yml
version: '1.0.3'
prefix: '&e☀ &e&lMacTime &8&l» '
online: '&a●'
offline: '&c●'
afk: '&8[&7&lAFK&8]'
no-permission: '&cNo Permission'

# %player_name% = 玩家的用户名
命令:
  ontime:
    player:
      # /ontime 的标题
      self-header: '&7&m    &r &a%player_name%&7 的在线时长 &7&m    &r'
      # /ontime <用户名> 的标题
      other-header: '&a%player_name%&7 的在线时长'
      no-ontime-data: '&c %player_name% &c没有在线时长数据!'
      divider: '&7&l&m                              '
    console:

无效:'控制台无法执行此命令。'
玩家缺少数据:'该玩家没有任何在线时长数据!'
重载:
消息:'成功重载模块:&f消息&7。'
配置:'成功重载模块:&f配置&7。'
全部:'成功重载模块:&f配置 &7和 &f消息&7。'

# %player_name% = 玩家用户名
  # {0} = Luckperm 组前缀
  # {1} = 总玩家数
  reset:
    expired:
      player: '&c玩家 %player_name% 的在线时长移除请求已过期!'
      group: '&c{0} 组的在线时长移除请求已过期!'
      wild: '&c所有用户的在线时长移除请求均已过期!'
    confirm:
      player: '&7确定要重置 &f%player_name%&7 的在线时长统计数据吗?&7[点击确认]'
      group: '&7确定要重置 &f{0}&7 组中所有玩家的在线时长统计数据吗?&7[点击确认]'
      wild: '&c确定要重置所有玩家的在线时长统计数据吗?&7[点击确认]'
    success:
      player: '&7已重置 &f%player_name%&7 的在线时长统计数据!'
      group: '&7已重置 &f{0}&7 组中 &f{1}&7 名玩家的在线时长统计数据!'
      wild: '&7已重置 &f{1}&7 名玩家的在线时长统计数据!'
    invalid:
      player: '&c您输入了无效的用户名!'

group: '&c您输入了无效的组名!'
      wild: '&c此操作当前已禁用!'
    player-does-not-have-data: ' &c%player_name% 没有在线时间数据!'
    # %command% - 重置命令,例如 "/mactime reset player Notch"
    hover-msg: '&a&l点击我&r'

#
# 在线时长命令 (/ontime)
#
ontime:
  player:
    current-ontime: '&f当前在线时长 &8➡ &e%mactime_current%'
    daily-ontime: '&f今日在线时长 &8➡ &e%mactime_daily%'
    weekly-ontime: '&f本周在线时长 &8➡ &e%mactime_weekly%'
    monthly-ontime: '&f本月在线时长 &8➡ &e%mactime_monthly%'
    yearly-ontime: '&f本年在线时长 &8➡ &e%mactime_yearly%'
    alltime-ontime: '&f总计在线时长 &8➡ &e%mactime_alltime%'
    afk-time: '&f总挂机时间 &8➡ &e%mactime_afktime%'
    last-online: '&f最后上线时间 &8➡ &e%mactime_lastonline%'
  console:
    current-ontime: '* 当前在线时长 ➡ %mactime_current%'
    daily-ontime: '* 今日在线时长 ➡ %mactime_daily%'
    weekly-ontime: '* 本周在线时长 ➡ %mactime_weekly%'
    monthly-ontime: '* 本月在线时长 ➡ %mactime_monthly%'
    yearly-ontime: '* 本年在线时长 ➡ %mactime_yearly%'
    alltime-ontime: '* 总计在线时长 ➡ %mactime_alltime%'
    afk-time: '* 挂机时间 ➡ %mactime_afktime%'
    last-online: '* 最后上线时间 ➡ %mactime_lastonline%'


#
# GUI 消息配置 (/mactime gui)
#
gui:
  # 玩家在线时长
  # {0} = 玩家总数
  po:
    title: '工作人员在线时长 ({0})'
    online: '&a&l在线'
    offline: '&c&l离线'
    current-ontime: '&e| &f当前在线时长 &8➡ &e%mactime_current%'
    daily-ontime: '&e| &f今日在线时长 &8➡ &e%mactime_daily%'
    weekly-ontime: '&e| &f本周在线时长 &8➡ &e%mactime_weekly%'
    monthly-ontime: '&e| &f本月在线时长 &8➡ &e%mactime_monthly%'
    yearly-ontime: '&e| &f本年在线时长 &8➡ &e%mactime_yearly%'
    alltime-ontime: '&e| &f总计在线时长 &8➡ &e%mactime_alltime%'
    afk-time: '&e| &f总挂机时间 &8➡ &e%mactime_afktime%'
    last-online: '&e| &f最后上线时间 &8➡ &e%mactime_lastonline% &f前'

  # 排序后的玩家在线时长(无 LuckPerms 排序的 GUI)
  # {0} = 玩家总数
  spo:
    title: '工作人员在线时长 ({0})'

  # 单独组别的在线时长 (/mactime gui [groupname])
  # {0} = LuckPerms 组名前缀
  # {1} = 玩家总数
  igo:
    titles:
      main: '{0}&8在线时长 ({1})'
      other: '其他成员在线时长 ({1})'
    error:
      invalid-group: '&c无效的组别'
      group-does-not-exist: '&c该组别在 LuckPerms 中不存在!'
  # 单个玩家的在线时长数据菜单
  # 当你在 /mactime gui 中点击玩家头像时显示的菜单
  io:
    title: '%player_name% 的数据'

# 排序在线时间
  # {0} = Luckperms 组前缀
  # {1} = 玩家总数
  so:
    title: '{0} &8玩家在线时间 ({1})'

  # {0} = 日期(例如:1/20、3/10)
  # {1} = 时间
  history-item:
    title: '过去7天的在线记录'
    entry: '&3{0} &8➡ &3{1}'
    empty: '&c该玩家在最近7天内未登录!'

# AFK 通知记录到控制台
# {0} = 总AFK时间(格式化为 hh:mm:ss)
AFK-Detection:
  afk: '现在处于离开状态'
  not-afk: '不再处于离开状态'
  afk-time: '离开了 {0}'

#
# Webhook 嵌入消息
#

webhook:
  join:
    title: $username 已加入服务器
    color: 0x00ff00
    # 可用占位符
    # $time - 玩家加入服务器的时间戳
    content:
      - "• 加入时间: `$time`"
  leave:
    title: $username 已离开
    color: 0xff0000
    # 可用占位符
    # $time_joined - 玩家加入服务器的时间戳
    # $time_left - 玩家离开服务器的时间戳
    # $time_online - 玩家在服务器上停留的总时长
    content:
      - "• 加入时间: `$time_joined`"
      - "• 离开时间: `$time_left`"
      - "• 在线总时长: `$time_online`"
  afk-start:
    title: $username 现在处于 AFK 状态
    color: 0xff9a00
    # 可用占位符
    # $time - 玩家变为 AFK 的时间戳
    # $afk_time - 玩家在服务器上处于 AFK 状态的总时长
    content:
      - "• AFK 起始时间: `$time`"
      - "• 累计 AFK 时长: `$afk_time`"
  afk-end:
    # 可用占位符 ($username)
    title: $username 不再处于 AFK 状态
    color: 0xff9a00
    # 可用占位符
    # $time - 玩家处于 AFK 状态的时间戳
    # $afk_time - 玩家处于 AFK 状态的时长
    # $total_afk_time - 玩家累计处于 AFK 状态的总时长
    content:
      - "• 自...起处于 AFK: `$time`"
      - "• AFK 时长: `$afk_time`"
      - "• 累计 AFK 时长: `$total_afk_time`"
  print:
    title: Ontime 统计数据 - $username
    color: 0xffffff
    # 可用占位符
    # $date
    # $uuid
    # $daily_ontime
    # $weekly_ontime
    # $monthly_ontime
    # $yearly_ontime
    # $alltime_ontime
    # $afk_time
    # $last_online
    content:
      - "• 日期: `$date`"
      - "• UUID: `$uuid`"
      - "• 每日在线时长: `$daily_ontime`"
      - "• 每周在线时长: `$weekly_ontime`"
      - "• 每月在线时长: `$monthly_ontime`"
      - "• 每年在线时长: `$yearly_ontime`"
      - "• 历史总在线时长: `$alltime_ontime`"
      - "• AFK 时长: `$afk_time`"
      - "• 最后上线时间: `$last_online`"
  saving:
    # 可用占位符 ($range)
    title: $range 的每周在线时长统计
    color: 0xffffff

支持与联系

如需报告错误、建议功能或任何其他事项,请通过 Discord 联系我。

  • 直接联系方式
    • -> ajmac

bStats

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源