Farmstead Mods
EN

АФК

Автоматический АФК, кик по бездействию, индикатор в таблисте.

На этой странице

Команды 2#

КомандаСинтаксисАлиасыПравоОписание
/afk/afk [<message>]—neoessentials.afk по соглашениюToggle AFK statusТолько игрок. Право neoessentials.afk проверяется внутри executes, не в requires. <message> — greedyString, уходит в рассылку как причина. Без аргумента причина null. Команда молча отказывается, если выключен чат-модуль (isChatEnabled), commands.afk или устаревший ChatManager.isAfkEnabled(). В excludedCommands по умолчанию есть afk — сам /afk таймер бездействия не сбрасывает.
/away/away [<message>]—neoessentials.afkToggle AFK status (alias)Тот же registerAfkCommand, что /afk: отдельный литерал, не redirect. Флаг commands.away не читается — оба литерала смотрят на commands.afk. В дефолтном excludedCommands строки away нет.

Примеры#

Вручную уйти в АФК с причиной#

Нужно пометить себя отошедшим и показать причину в рассылке, не ждать timeout.

/afk отошёл на 10 минут

Лично вам — now_afk. Если afk.broadcastOnAfk (или enableafkBroadcasts) включён, всем уходит afkMessage с {player} и указанной причиной. Повторный /afk снимает статус (no_longer_afk + returnMessage). Команда /afk есть в excludedCommands, поэтому обработчик команд не сбрасывает таймер и не снимает АФК до toggle.

Вернуться движением, а не командой#

Проверить, что детектор движения снимает АФК сам.

/afk
/afk

Первый вызов ставит АФК. Дальше достаточно пройтись: AfkMovementDetector раз в 5 с сравнивает позицию/yaw/pitch с порогами movementThreshold (0.1) и rotationThreshold (5.0). Если enableActivityTracking и trackMovement включены, updateActivity снимает АФК и шлёт return-рассылку. Второй /afk в примере — ручной возврат, если двигаться не хотите. Покачивание головой на месте срабатывает, мелкий дрейф ниже порога — нет.

Тонкие места#

Индикатор в таблисте берётся из tablist.json, не из afk#

AfkTablistHandler считает prefix/suffix из полей AfkManager (enableTablistIndicator, tablistAfkPrefix, tablistAfkSuffix), но setTabListDisplayName закомментирован — имя в списке он не меняет. Реальный суффикс рисует TablistManager: tablist.json → showAfkIndicator (по умолчанию true) и afkSuffix (по умолчанию &7[AFK]). Ключей enableTablistIndicator / tablistAfkPrefix в секции afk конфига нет.

Что делать: Индикатор настраивайте в tablist.json. Секция afk отвечает за timeout, kick, рассылки и детекторы, не за текст в списке игроков.

Кик: kickTimeout, exempt и предупреждение#

Проверка раз в 30 с. Кик включён, если kickTimeout > 0 (секунды; есть совместимый kickTimeoutMinutes), либо явно kickAfkPlayers: true. Явный kickAfkPlayers: false глушит кик даже при timeout > 0. Если кик включили при timeout 0, код принудительно ставит 30 минут и пишет error в лог. neoessentials.afk.exempt пропускает только кик, не авто-АФК. За минуту до кика уходит kick_warning; из-за шага 30 с сообщение может повториться. Текст кика — afkkickMessage, иначе локализованный шаблон.

Что делать: Для кика достаточно kickTimeout: 900 (15 минут после ухода в АФК). Персоналу выдайте neoessentials.afk.exempt.

Детектор движения и анти-ферма кликов#

AfkMovementDetector — отдельный поток, раз в 5 с server.execute читает координаты. Учитывается только если enableActivityTracking и trackMovement. Чат (trackChat), команды (trackCommands) и взаимодействия (trackInteractions) — отдельные рубильники; мастер enableActivityTracking: false глушит все четыре. AfkActivityHandler по кликам/дропу: больше 30 одинаковых действий за 60 с копит score; после 300 это действие перестаёт сбрасывать таймер. excludedCommands по умолчанию: afk, list, who, tps, ping, help, ?.

Что делать: Макросы на клик по блоку АФК не отобьют, когда score превышен. Если /list не должен снимать АФК — он уже в списке; /away туда не входит (см. knownIssues).

/afk требует включённый чат-модуль#

Несмотря на отдельную систему АФК, команда выходит с commands.neoessentials.afk.disabled, если isChatEnabled() ложь или ChatManager.isAfkEnabled() ложь. Авто-пометка по timeout при этом живёт в AfkManager и от чат-команды не зависит, но ручной toggle недоступен.

Что делать: Держите чат-модуль включённым, если нужен /afk. Выключить только ручную команду можно commands.afk: false (это погасит и /away).

Сон, неуязвимость и хранение#

ignoreAfkInSleep: true (по умолчанию) исключает АФК-игроков из процента сна. invulnerableWhenAfk по умолчанию false. Состояние пишется в коллекцию afk_data (легаси-файл afk_data.json мигрирует), autoSave / saveInterval — периодический сброс. Проверка авто-АФК идёт раз в 30 с, поэтому фактический timeout 300 с может сработать между 300 и 330 с.

Что делать: Не ждите точной секунды. Для PvP-арен invulnerableWhenAfk лучше не включать.

Известные проблемы#

/away не снимает АФК, пока trackCommands включён#

CommandEvent срабатывает до executes. Для /away (его нет в дефолтном excludedCommands) AfkCommandHandler вызывает updateActivity: если игрок уже АФК, статус снимается. Затем toggleAfk ставит АФК снова — в чат могут уйти и return, и «is now AFK», а игрок остаётся АФК. /afk в списке исключений, поэтому туда-обратно работает.

Что делать: Возвращайтесь командой /afk или движением. Либо добавьте away в afk.excludedCommands.

Права 2#

УзелВ реестреЧто даёт
neoessentials.afkреестр: даUse AFK system
neoessentials.afk.exemptреестр: нетExempt from AFK kick

Подробное руководство#

Раздел ниже — исходная документация проекта (docs/Wiki/AFKSystem.md). Ссылки на другие страницы вики переписаны на этот сайт; текст самих руководств не редактируется, чтобы синк с апстримом не давал конфликтов.

Version: 1.0.2.6 · Config: config.json → afk section


Overview#

The AFK system automatically marks players as AFK after a configurable period of inactivity, broadcasts status changes, shows an indicator in the tablist, and optionally kicks long-term AFK players.


Config (config.json → afk)#

Key Default Description
enabled true Enable/disable the AFK system
timeout 300 Seconds of inactivity before a player is marked AFK
kickTimeout 0 Seconds after going AFK before being kicked (0 = disabled). Setting this to any value > 0 automatically enables AFK kicking.
kickAfkPlayers (auto) Optional explicit override. Omit this key (recommended) and let kickTimeout > 0 enable kicking. Set to false to force-disable kicking even if kickTimeout > 0.
afkkickMessage "Kicked for being AFK too long" Message shown on AFK kick
enableafkBroadcasts true Broadcast AFK status changes to all players
broadcastOnAfk true Broadcast when a player goes AFK
broadcastOnReturn true Broadcast when a player returns from AFK
afkMessage "{player} is now AFK" Broadcast when going AFK ({player} placeholder)
returnMessage "{player} is no longer AFK" Broadcast on return
ignoreAfkInSleep true AFK players do not count for sleep percentage
enableActivityTracking true Track player activity to detect inactivity
trackMovement true Player movement resets AFK timer
trackChat true Chat messages reset AFK timer
trackCommands true Commands reset AFK timer
trackInteractions true Block/entity interactions reset AFK timer
movementThreshold 0.1 Minimum movement distance to count as activity
rotationThreshold 5.0 Minimum look-rotation change to count as activity
excludedCommands ["afk","list","who","tps","ping","help","?"] Commands that do NOT reset the AFK timer
invulnerableWhenAfk false Make AFK players immune to damage while AFK
autoSave true Periodically save AFK state to disk
saveInterval 60 Auto-save interval in seconds

enableActivityTracking is a master switch — set it to false and none of trackMovement/ trackChat/trackCommands/trackInteractions reset the AFK timer regardless of their own value. Each of the four sub-toggles independently gates its own activity source (movement ticks, chat messages, command execution, block/item interactions). A genuine, non-muted, non-frozen chat message now resets the AFK timer when trackChat is enabled (previously chat never reset the timer at all, regardless of this setting — fixed alongside the rest of this audit).

Tablist AFK indicator is NOT configured here. The enableTablistIndicator/ tablistAfkPrefix/tablistAfkSuffix keys previously documented in this section don't exist in the shipped afk config, and the code path that would consume them (AfkTablistHandler) is dead — it computes a display name but never applies it. The AFK indicator that actually renders is controlled by tablist.json → showAfkIndicator (default true) and afkSuffix (default " &7[AFK]", suffix only — there's no separate prefix option). See Tablist System for the rest of that config.


Commands#

Command Syntax Permission Description
/afk /afk [message] neoessentials.afk Toggle your AFK status manually, optionally with a custom reason shown in the broadcast
/away alias same Alias

Permissions#

Node Default Description
neoessentials.afk ✅ Use /afk to manually toggle AFK
neoessentials.afk.exempt 🔒 Exempt from AFK kick timer

How It Works#

  1. Activity detection — AfkActivityHandler listens for movement, chat, commands, and interactions. Each event that passes the threshold resets the player's inactivity timer.
  2. AFK trigger — After timeout seconds of no qualifying activity, AfkManager marks the player as AFK, broadcasts the message, and updates the tablist.
  3. Return — Any qualifying activity while AFK removes the AFK flag and broadcasts the return message.
  4. Kick — If kickTimeout > 0, a player who remains AFK longer than that value is kicked with afkkickMessage.
  5. Sleep — With ignoreAfkInSleep: true, AFK players are excluded from the sleep count so the night can be skipped without them.
  6. Invulnerability — With invulnerableWhenAfk: true, players take no damage while AFK.

Anti-Spam Filter#

The activity tracker (AfkActivityHandler, covering block/item right-click, left-click-attack, and item-toss events) has a built-in repetitive-action filter. If the same action type occurs more than 30 times within a rolling 60-second window, the suspicion score increases by 10 per occurrence over that threshold; once the score exceeds 300 that action stops resetting the AFK timer, preventing AFK farms via automated clicking. The score decays by 5 the next time that action type recurs after a 5-minute gap (it does not decay purely from the 60-second window elapsing).


Back to Wiki Home