> For the complete documentation index, see [llms.txt](https://docs.xandtech.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xandtech.fr/home/xtimerewards/features/afk-mode.md).

# AFK Mode (Reward-Earning)

An opt-in, reward-earning mode — completely separate from the passive [AFK Detection](/home/xtimerewards/features/afk-detection.md) system, which never grants rewards. `/afk` opens a confirmation menu, then teleports the player to a fixed point and keeps a menu forced open (no escaping it except its own leave button) until they leave. While in it: no movement, block/entity interaction, item drops, damage, or commands work.

```yaml
afk-mode:
  enabled: true
  teleport:
    world: world
    x: 0.5
    y: 100.0
    z: 0.5
    yaw: 0.0
    pitch: 0.0
```

Set the teleport point by standing where you want it and running `/xtimerewards admin afk setpoint`.

## Reward tiers (`afk-mode-rewards.yml`)

Unlike milestones, progress is **per-session** (resets to zero when the player leaves) rather than a lifetime claim.

```yaml
rewards:
  - id: cash-per-minute
    interval-seconds: 60
    repeat: true
    display-name: "<green>$10"
    icon: GOLD_NUGGET
    rewards:
      - type: economy
        value: "10"

  - id: points-5min
    interval-seconds: 300
    repeat: false
    display-name: "<gold>10 Points"
    icon: NETHER_STAR
    rewards:
      - type: command
        value: "points give %player% 10"
```

| Field                            | Meaning                                                                                                                     |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `interval-seconds`               | How often (`repeat: true`) or after how long (`repeat: false`) it grants.                                                   |
| `repeat`                         | `true` = grants again every `interval-seconds` for as long as the session lasts. `false` = grants exactly once per session. |
| `display-name` / `icon` / `lore` | Shown in the AFK-mode menu's reward grid.                                                                                   |
| `rewards`                        | Same [reward-entry format](/home/xtimerewards/features/playtime-and-milestones.md#reward-types) as milestones.              |

## Daily reward cap

```yaml
afk-mode:
  daily-cap-seconds: 0   # 0 = no cap
```

Caps how many AFK-mode reward-earning seconds a player can rack up per day (resets on the `period-reset.daily` boundary — see [Installation & Setup](/home/xtimerewards/getting-started/getting-started.md)). A player is blocked from entering once already at the cap, and auto-exited (with a message) the moment they'd reach it mid-session. Players holding **`xtimerewards.afkmode.bypasscap`** ignore this entirely.

## Player invisibility

```yaml
afk-mode:
  hide-players: true
```

Makes a player invisible to everyone else for the duration of their session (and hides already-active sessions from a newly-joining player) — purely cosmetic, doesn't affect the "no interaction" rules enforced regardless.

## Surprise items

```yaml
surprise-items:
  enabled: false
  min-interval-seconds: 90
  max-interval-seconds: 300
  visible-seconds: 20
  items:
    - id: bonus-cash
      display-name: "<gold>✦ Surprise Cash!"
      icon: GOLD_INGOT
      weight: 3
      rewards:
        - type: economy
          value: "50"
    - id: bonus-diamond
      display-name: "<aqua>✦ Surprise Diamond!"
      icon: DIAMOND
      weight: 1
      rewards:
        - type: item
          material: DIAMOND
          amount: 1
```

Off by default. When enabled, a bonus item randomly appears in one of `menus/afk-mode.yml`'s `surprise-slots` (a random delay between `min-interval-seconds` and `max-interval-seconds`) — **the only thing in that menu meant to be clicked** besides the leave button. Disappears again if unclaimed after `visible-seconds`, at which point a new random interval starts. One item is picked at random each time, weighted by `weight` (higher = more likely).

{% hint style="info" %}
`surprise-slots` is set in `menus/afk-mode.yml`, not here — see [Menus & GUI Customization](/home/xtimerewards/features/menus.md).
{% endhint %}

## Leaving

Click the menu's leave item, or run `/afk` again while already in the mode to just re-open the menu. Leaving flushes any remaining unpersisted seconds and announces in chat how long the session lasted and what was earned.

{% hint style="warning" %}
If a player disconnects mid-session (crash, kick, server stop), they're restored to where they were before entering the next time they join — rewards already earned before the disconnect are kept.
{% endhint %}

## Admin management

`/xtimerewards admin afk setafk <player>` / `unafk <player>` force a player in or out. `/xtimerewards admin afk reset <player>` resets their lifetime AFK-mode seconds counter. `/xtimerewards admin afk setpoint` sets the teleport point to your current location. See [Commands](/home/xtimerewards/reference/commands.md) and [Permissions](/home/xtimerewards/reference/permissions.md).

## Placeholders & Discord

`%xtimerewards_is_afk_mode%`, `%xtimerewards_afk_mode%` / `%xtimerewards_afk_mode_formatted%` (lifetime), `%xtimerewards_afk_mode_session%` / `%xtimerewards_afk_mode_session_formatted%` (current session) — see [PlaceholderAPI](/home/xtimerewards/reference/placeholderapi.md). AFK-mode time isn't a Discord-notified event on its own, but counts toward the lifetime AFK leaderboard (`/afk top`).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xandtech.fr/home/xtimerewards/features/afk-mode.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
