KeyAll 是一款用于 Minecraft 服务器的先进按玩家计时的密钥分发系统。它追踪每个玩家的单独游戏时长,并独立地为每位玩家在指定间隔自动分发密钥或执行命令。
功能
- ✅ 按玩家追踪:每位玩家拥有基于其实际游戏时长的独立计时器
- ✅ 多个 KeyAll 事件:创建不限数量的密钥分发事件,设置不同的间隔时间
- ✅ 权限支持:可选择要求特定权限才能参与某个 KeyAll 事件
- ✅ 多条命令:为每个 KeyAll 事件按顺序执行多条命令
- ✅ 暂停/恢复:临时暂停和恢复 KeyAll 事件
- ✅ PlaceholderAPI 支持:通过占位符显示距离下一个密钥的剩余时间
- ✅ 持久化数据:玩家数据被保存并在服务器重启后保留
- ✅ 性能优化:异步检查与高效的数据管理
安装
- 下载 KeyAll 插件 JAR 文件
- 将其放入服务器的
plugins 文件夹中
- (可选)安装 PlaceholderAPI 以支持占位符
- 重启服务器
- 在
plugins/KeyAll/config.yml 中配置插件
命令
| 命令 |
描述 |
权限 |
/keyall create <name> <interval> "<command>" [permission] |
创建一个新的 KeyAll 事件 |
keyall.admin |
/keyall delete <name> |
删除一个 KeyAll 事件 |
keyall.admin |
/keyall pause <name> |
暂停一个 KeyAll 事件 |
keyall.admin |
/keyall resume <name> |
恢复一个已暂停的 KeyAll 事件 |
keyall.admin |
/keyall list |
列出所有 KeyAll 事件 |
keyall.admin |
/keyall info <name> |
查看有关 KeyAll 事件的详细信息 |
keyall.admin |
/keyall reload |
重新加载插件配置 |
keyall.admin |
命令示例
# 创建一个普通密钥,每小时发放一次
/keyall create common_key 60m "crates give key %playername% 1 commonkey"
# 为 VIP 玩家每 3 小时创建一个稀有密钥
/keyall create rare_key 3h "crates give key %playername% 1 rarekey" keyall.vip
# 使用多条命令创建每日奖励
/keyall create daily_reward 24h "eco give %playername% 5000" none
/keyall create daily_bonus 24h "give %playername% diamond 5" none
# 删除一个 KeyAll 事件
/keyall delete common_key
# 暂停和恢复
/keyall pause rare_key
/keyall resume rare_key
时间格式
使用时间后缀表示间隔:
s = 秒(例如,30s = 30 秒)
m = 分钟(例如,60m = 60 分钟)
h = 小时(例如,2h = 2 小时)
d = 天(例如,1d = 1 天)
占位符
需要安装 PlaceholderAPI。
| 占位符 |
描述 |
示例输出 |
%keyall_time_<name>% |
格式化显示的剩余时间 |
1h 30m |
%keyall_seconds_<name>% |
剩余的秒数 |
5400 |
%keyall_minutes_<name>% |
剩余的分钟数 |
90 |
%keyall_hours_<name>% |
剩余的小时数 |
1 |
使用示例:
%keyall_time_common_key% → "45m 30s"
%keyall_time_rare_key% → "2h 15m"
%keyall_minutes_daily_reward% → "120"
配置示例
keyalls:
keyall:
interval: 10s
commands:
- "crates give key %playername% 1 keyall"
- '[click] /warp Crates'
- '[message] &7You got a key! &5&lClick Here&r &7 to warp to crates area'
permission: none
paused: false
vip_key:
interval: "2h"
commands:
- "crates give key %playername% 1 vipkey"
- "broadcast &e%playername% &areceived a VIP key!"
permission: "keyall.vip"
paused: false
工作原理
- 游戏时长追踪:插件以秒为单位追踪每位玩家的总游戏时长
- 独立计时器:每位玩家针对每个 KeyAll 事件都有各自的计时器
- 间隔检查:每秒检查是否有玩家达到了其设定的间隔
- 命令执行:当玩家达到间隔时,按顺序执行所有命令
- 计时器重置:玩家在获得奖励后,该特定 KeyAll 事件的计时器将重置
示例场景
- 玩家 A 加入并玩了 2 小时
common_key 的间隔是 1 小时
- 玩家 A 在游戏时长 1 小时和 2 小时时获得密钥
- 如果玩家 A 离开并重新加入,其游戏时长从 2 小时继续累计
- 玩家 A 将在总游戏时长达到 3 小时时获得下一个密钥
权限
keyall.admin - 访问所有 KeyAll 命令(默认:op)
- 可在配置文件中为每个 KeyAll 事件设置自定义权限
玩家数据
玩家数据存储于 plugins/KeyAll/playerdata/<uuid>.yml,包含:
- 总游戏时长
- 每个 KeyAll 事件的最后接收时间
- 会话信息
数据在玩家离开时自动保存,并在服务器重启后保留。
性能
- 每秒进行异步检查以最小化服务器延迟
- 使用 ConcurrentHashMap 的高效数据结构
- 缓存玩家数据以减少文件 I/O
- 针对数百名玩家的服务器进行了优化
? 支持
如有问题、建议或贡献:
KeyAll - 让密钥分发公平且针对每位玩家! ?
KeyAll is an advanced per-player timed key distribution system for Minecraft servers. It tracks individual player playtime and automatically distributes keys or executes commands at specified intervals for each player independently.
Features
- ✅ Per-Player Tracking: Each player has their own independent timer based on their actual playtime
- ✅ Multiple KeyAll Events: Create unlimited key distribution events with different intervals
- ✅ Permission-Based: Optionally require permissions for specific KeyAll events
- ✅ Multiple Commands: Execute multiple commands in sequence for each KeyAll event
- ✅ Pause/Resume: Temporarily pause and resume KeyAll events
- ✅ PlaceholderAPI Support: Display time remaining until next key with placeholders
- ✅ Persistent Data: Player data is saved and persists across server restarts
- ✅ Optimized Performance: Async checking with efficient data management
Installation
- Download the KeyAll plugin JAR file
- Place it in your server's
plugins folder
- (Optional) Install PlaceholderAPI for placeholder support
- Restart your server
- Configure the plugin in
plugins/KeyAll/config.yml
Commands
| Command |
Description |
Permission |
/keyall create <name> <interval> "<command>" [permission] |
Create a new KeyAll event |
keyall.admin |
/keyall delete <name> |
Delete a KeyAll event |
keyall.admin |
/keyall pause <name> |
Pause a KeyAll event |
keyall.admin |
/keyall resume <name> |
Resume a paused KeyAll event |
keyall.admin |
/keyall list |
List all KeyAll events |
keyall.admin |
/keyall info <name> |
View detailed info about a KeyAll event |
keyall.admin |
/keyall reload |
Reload the plugin configuration |
keyall.admin |
Command Examples
# Create a common key that gives every hour
/keyall create common_key 60m "crates give key %playername% 1 commonkey"
# Create a rare key for VIP players every 3 hours
/keyall create rare_key 3h "crates give key %playername% 1 rarekey" keyall.vip
# Create a daily reward with multiple commands
/keyall create daily_reward 24h "eco give %playername% 5000" none
/keyall create daily_bonus 24h "give %playername% diamond 5" none
# Delete a KeyAll event
/keyall delete common_key
# Pause and resume
/keyall pause rare_key
/keyall resume rare_key
Time Format
Use these suffixes for time intervals:
s = seconds (e.g., 30s = 30 seconds)
m = minutes (e.g., 60m = 60 minutes)
h = hours (e.g., 2h = 2 hours)
d = days (e.g., 1d = 1 day)
Placeholders
Requires PlaceholderAPI to be installed.
| Placeholder |
Description |
Example Output |
%keyall_time_<name>% |
Time remaining in formatted text |
1h 30m |
%keyall_seconds_<name>% |
Seconds remaining |
5400 |
%keyall_minutes_<name>% |
Minutes remaining |
90 |
%keyall_hours_<name>% |
Hours remaining |
1 |
Example Usage:
%keyall_time_common_key% → "45m 30s"
%keyall_time_rare_key% → "2h 15m"
%keyall_minutes_daily_reward% → "120"
Configuration Example
keyalls:
keyall:
interval: 10s
commands:
- "crates give key %playername% 1 keyall"
- '[click] /warp Crates'
- '[message] &7You got a key! &5&lClick Here&r &7 to warp to crates area'
permission: none
paused: false
vip_key:
interval: "2h"
commands:
- "crates give key %playername% 1 vipkey"
- "broadcast &e%playername% &areceived a VIP key!"
permission: "keyall.vip"
paused: false
How It Works
- Playtime Tracking: The plugin tracks each player's total playtime in seconds
- Independent Timers: Each player has their own timer for each KeyAll event
- Interval Checking: Every second, the plugin checks if any player has reached their interval
- Command Execution: When a player reaches the interval, all commands are executed in sequence
- Timer Reset: The player's timer for that specific KeyAll resets after receiving the reward
Example Scenario
- Player A joins and plays for 2 hours
common_key interval is 1 hour
- Player A receives the key at 1 hour and 2 hours of playtime
- If Player A leaves and rejoins, their playtime continues from 2 hours
- Player A will receive the next key at 3 hours of total playtime
Permissions
keyall.admin - Access to all KeyAll commands (default: op)
- Custom permissions can be set per KeyAll event in the config
Player Data
Player data is stored in plugins/KeyAll/playerdata/<uuid>.yml and includes:
- Total playtime
- Last received time for each KeyAll event
- Session information
Data is automatically saved when players leave and persists across server restarts.
Performance
- Async checking every second to minimize server lag
- Efficient data structures using ConcurrentHashMap
- Minimal file I/O with cached player data
- Optimized for servers with hundreds of players
? Support
For issues, suggestions, or contributions:
KeyAll - Making key distribution fair and per-player! ?
评论 0
登录后参与评分
还没有评论,来抢沙发吧