Detect AFK Players
AFK/idle detection that's extremely performant · Players go AFK after 3 minutes (configurable) without moving their mouse · Extend with plenty of add-ons!
截图
介绍
Detect AFK Players
Detects player inactivity based on head rotation – simple, accurate, and fast. Intended as a dependency for datapacks and server operators.
This doesn’t do much without add-ons (better performance), so you’ll probably want to download one of those too.
Add-ons
- Pause Day Cycle – Pauses time when all players are AFK
- AFK Sleep – Allows sleeping when players are AFK, and handles dimensions + updates correctly unlike alternatives
- AFK Dim Names – Player names are dimmed when AFK
- AFK Message – Chat notifications for player status
- AFK Sit – Players sit down when they’re AFK
Core Functionality
- Tags players as
afkafter 3 minutes - Detection based on head rotation, more accurate than position
- Significantly better performance than alternatives
- Modular (see above for add-ons)
To configure how long it takes to become AFK, use the command below.
By default, this is set to 3600 (which is 3 minutes).
/scoreboard players set .threshold afk.settings NUMBER_OF_TICKS
To enable players using /trigger afk, use the following command. No players are allowed to become AFK manually unless enabled by an admin.
/scoreboard players enable PLAYER afk
Performance
Common AFK detection methods check X/Y/Z, inventory changes, and block interactions – often on every tick. Instead, this data pack does a single head rotation NBT check per player every 1.5 seconds, resulting in a significantly less computation as compared to alternatives, sometimes by up to two orders of magnitude.
The head rotation method also eliminates false triggers from entity interactions (players attacking, explosions, etc) and anti-AFK automations such as water streams.
API
Two function tags are provided:
afk:away– Executed as player on AFKafk:back– Executed as player on return
Additional documentation is provided on GitHub, such as all the stable scoreboard objectives and how to use them.
Example implementation:
kick-afk-players/data/afk/tags/functions/away.json
{ "values": ["afk_kick:kick"] }
kick-afk-players/data/afk_kick/functions/kick.mcfunction
kick @s AFK
常见问题
Detect AFK Players 支持哪些 Minecraft 版本?
Detect AFK Players 支持 Minecraft Java 版 1.18–1.21.8,共 24 个版本,可用的加载器:Fabric / Forge / NeoForge / Quilt。下载时注意选择和你游戏版本一致的文件。
Detect AFK Players 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Forge / NeoForge / Quilt,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。
clo4 的其他作品
查看全部 →
Pause Day Cycle
Pause the in-game day if nobody's online or when all players are AFK. Fixes local difficulty on small SMP servers.
No Free Deaths: Better keepInventory
Lose XP and hunger with keepInventory. Stops players abusing death as a free reset, but without the punishment of losing all their stuff 😌
AFK Dim Names
Dim player names when they go AFK. Shows above their heads and in the server list.
AFK Sit
Players sit while AFK
评论
登录后评论和评分