
Cobblemon AFK Guard
Cobblemon AFK Guard 是一款适用于 Minecraft 1.21.1 服务器的 Fabric 模组,用于追踪玩家在线状态,将不活跃玩家标记为 AFK(离机),更新其标签页名称,并可在配置的时间延迟后将其踢出服务器。
该模组围绕 Cobblemon 玩法及常见的服务端边缘情况设计,从而降低玩家在正常使用 Cobblemon 功能时被误踢的风险。
功能特性
- 带有可选自动踢出功能的真实 AFK 计时器。
- 针对战斗、战斗界面选择、电脑箱使用、牧场相关交互以及类商人菜单等场景的 Cobblemon 感知活动处理。
- 当模组同时安装在服务端和客户端时,提供额外的 GUI 活动检测。
- 从可配置的消息列表中随机选取 AFK、返回和踢出的提示信息。
/afk refresh 命令可在无需重启服务器的情况下重新加载配置文件。
- 支持手动豁免、OP 绕过以及睡眠投票支持。
- 消息中支持
$player 占位符和 Minecraft 样式代码。
工作原理
仅服务端安装
完全支持仅服务端安装模式。
模组会追踪移动、视角变化、聊天、指令、普通交互、物品栏操作、商人交互以及服务端可见的 Cobblemon 活动。这包括在 Cobblemon 战斗期间传输至服务端的战斗相关数据包。这是大多数服务器推荐的基线方案。
服务端 + 客户端安装
在服务端和客户端均安装该模组可增强对客户端主导界面的活动报告。
这能改善对 Cobblemon 战斗界面、战斗请求界面、Cobblemon 电脑箱界面以及受支持的商店界面的 AFK 检测准确性,因为这些界面中的某些操作可能不会像普通交互那样自然生成数据包发送至服务端。如果您希望点击“Fight”(攻击)、移动按钮、“Switch”(切换)及其他类似战斗 UI 操作能够可靠地重置 AFK 计时器,这是最佳选择。
命令
/afk 切换您自己的 AFK 状态。
/afk switch <player> 切换其他玩家的 AFK 状态。
/afk exemptions 列出被手动豁免的玩家。
/afk exemptions add <player> 将某玩家加入豁免列表。
/afk exemptions remove <player> 将某玩家从豁免列表中移除。
/afk refresh 重新加载配置文件。
配置
配置文件生成路径如下:
config/cobblemon_afk_guard.json
重要说明:
- 编辑文件后请使用
/afk refresh 生效。
idleThresholdSeconds 以真实秒为单位计算。
kickDelayAfterAfkSeconds 在玩家被标记为 AFK 后开始计时。
- 消息列表每次都会随机选取一条条目。
- 使用
$player 插入玩家名称。
- 在配置中使用
& 风格代码。例如,&0 的处理方式与原版黑色文本的 section-sign 代码相同。
- 也接受
§ 风格代码以保持兼容性。
- 如需查看完整的 Minecraft 颜色/样式代码列表及使用详情,请参阅 Minecraft Wiki:
默认配置:
{
"idleThresholdSeconds": 240,
"kickDelayAfterAfkSeconds": 300,
"afkStartMessages": ["&e&o$player is now AFK.", "&e&o$player used Rest."],
"broadcastAfkStart": true,
"afkReturnMessages": [
"&a&o$player is no longer AFK.",
"&a&o$player woke up from Rest."
],
"broadcastAfkReturn": true,
"afkNameFormat": "&7[AFK] &r$player",
"afkKickMessages": [
"&fYou have been kicked for being AFK too long.",
"&fYou have been kicked for being AFK too long. Snorlax won the nap battle."
],
"countExemptPlayersInSleepVote": false
}
安装
适用于 Minecraft 1.21.1,必需依赖:
- Fabric Loader
- Fabric API
- Fabric Language Kotlin
- Cobblemon
1.7.3+1.21.1
- Cobblemon AFK Guard
可选兼容项:
- Cobbledollars
2.0.0+Beta-5.1
服务端安装步骤:
- 将模组 jar 文件放入服务端的
mods 文件夹。
- 首次启动服务器以生成配置文件。
- 编辑
config/cobblemon_afk_guard.json。
- 运行
/afk refresh,或者如果您更新了模组 jar 文件本身,则重启服务器。
可选客户端安装步骤:
- 将相同的模组 jar 文件放入客户端的
mods 文件夹。
- 保持模组在服务端正常运行。
- 正常加入服务器。
客户端安装是可选的,但如果您希望在 Cobblemon 战斗菜单及其他模组化界面中获得最佳检测效果,建议进行安装。
兼容性说明
- OP 玩家会被 AFK 系统忽略。
- 被手动豁免的玩家会被 AFK 系统忽略。
- 默认情况下,被豁免的玩家不计入睡眠投票。
- 仅仅打开一个菜单并不会使玩家保持活跃状态,真实的交互才是关键。
- 仅凭服务端无法完美检测某些模组化 GUI,因此安装客户端模组可提高检测准确性。

Cobblemon AFK Guard
Cobblemon AFK Guard is a Fabric mod for Minecraft 1.21.1 servers that tracks player presence, marks inactive players as AFK, updates their tab name, and can kick them after a configurable delay.
It is designed around Cobblemon gameplay and common server-side edge cases, so players are less likely to be kicked while they are actually using Cobblemon features.
Features
- Real AFK timers with optional automatic kick.
- Cobblemon-aware activity handling for battles, battle UI selections, PC usage, Pasture-related interaction, and merchant-style menus.
- Extra GUI activity detection when the mod is installed on both the server and the client.
- Random AFK, return, and kick messages from configurable message lists.
/afk refresh to reload the config without restarting the server.
- Manual exemptions, OP bypass, and sleep vote support.
- Supports
$player placeholders and Minecraft style codes in messages.
How it works
Server-only install
Server-only is fully supported.
The mod tracks movement, camera changes, chat, commands, normal interactions, inventory actions, merchant actions, and server-visible Cobblemon activity. This includes battle-related packets that reach the server during Cobblemon battles. This is the recommended baseline for most servers.
Server + client install
Installing the mod on both the server and the client enables enhanced activity reporting for client-heavy screens.
This improves AFK detection in interfaces such as Cobblemon battle screens, battle request screens, Cobblemon PC screens, and supported shop screens where some actions may not naturally reach the server as normal interaction packets. This is the best option if you want clicks on Fight, move buttons, Switch, and similar battle UI actions to reset AFK reliably.
Commands
/afk toggles your own AFK state.
/afk switch <player> toggles AFK for another player.
/afk exemptions lists manually exempt players.
/afk exemptions add <player> adds a player to the exemption list.
/afk exemptions remove <player> removes a player from the exemption list.
/afk refresh reloads the config file.
Config
The config file is created at:
config/cobblemon_afk_guard.json
Important notes:
- Use
/afk refresh after editing the file.
idleThresholdSeconds is measured in real seconds.
kickDelayAfterAfkSeconds starts counting after the player is marked as AFK.
- Message lists choose a random entry each time.
- Use
$player to insert the player name.
- Use
& style codes in the config. For example, &0 is treated the same as the vanilla section-sign code for black text.
§ style codes are also accepted for compatibility.
- For the full list of Minecraft color/style codes and usage details, see the Minecraft Wiki:
Default config:
{
"idleThresholdSeconds": 240,
"kickDelayAfterAfkSeconds": 300,
"afkStartMessages": ["&e&o$player is now AFK.", "&e&o$player used Rest."],
"broadcastAfkStart": true,
"afkReturnMessages": [
"&a&o$player is no longer AFK.",
"&a&o$player woke up from Rest."
],
"broadcastAfkReturn": true,
"afkNameFormat": "&7[AFK] &r$player",
"afkKickMessages": [
"&fYou have been kicked for being AFK too long.",
"&fYou have been kicked for being AFK too long. Snorlax won the nap battle."
],
"countExemptPlayersInSleepVote": false
}
Installation
For Minecraft 1.21.1, required:
- Fabric Loader
- Fabric API
- Fabric Language Kotlin
- Cobblemon
1.7.3+1.21.1
- Cobblemon AFK Guard
Optional compatibility:
- Cobbledollars
2.0.0+Beta-5.1
Server install:
- Put the mod jar in the server
mods folder.
- Start the server once to generate the config.
- Edit
config/cobblemon_afk_guard.json.
- Run
/afk refresh, or restart the server if you updated the mod jar itself.
Optional client install:
- Put the same mod jar in the client
mods folder.
- Keep the mod on the server as usual.
- Join normally.
Installing on the client is optional, but recommended if you want the best detection inside Cobblemon battle menus and other modded screens.
Compatibility notes
- OPs are ignored by the AFK system.
- Manually exempt players are ignored by the AFK system.
- By default, exempt players do not count toward sleep voting.
- Simply leaving a menu open does not keep a player active. Real interactions are what matter.
- Some modded GUIs cannot be detected perfectly from the server alone, which is why client installation improves accuracy.
评论 0
登录后参与评分
还没有评论,来抢沙发吧