RA-AfkStatus
Author: RajaAditya Website: rajaaditya.my.id Version: 1.0 API: Paper 1.21.x (1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4)
Overview
RA-AfkStatus is a lightweight standalone plugin for Paper 1.21.x that detects and manages AFK (Away From Keyboard) status for players. Designed for OneBlock servers where players frequently leave their characters idle during AFK farms.
- Automatic AFK detection based on position tracking
- Manual AFK toggle via
/afk - Anti-piston abuse protection (3-block exit threshold)
- Admin AFK list with
/afk list - Live config reload via
/afk reload - PlaceholderAPI support
- Fully customizable messages via
messages.yml - No island plugin dependencies
- Console-compatible admin commands
Dependencies
| Dependency | Type | Version |
|---|---|---|
| Paper | Server | 1.21.x |
| Java | Runtime | 21 |
| PlaceholderAPI | Required | 2.11+ |
Installation
- Download
RA-AfkStatus-1.0.jar - Place it in your
plugins/folder - Ensure PlaceholderAPI is installed
- Start or restart the server
- The plugin will auto-generate
config.ymlandmessages.yml - Run
/afk reloadafter editing any configuration file
No server restart required after editing configuration files.
AFK Detection System
How It Works
A scheduler runs every 30 seconds and checks each online player:
- Records the player's current position
- Compares it with the last recorded position
- If position has not changed for
afk-timeout-minutes→ player is marked AFK - When an AFK player moves 3 or more blocks from their AFK entry position → AFK is removed
Automatic Detection
| Trigger | Action |
|---|---|
| No movement for X minutes | Player marked AFK automatically |
| Moved 3+ blocks from AFK position | AFK removed automatically |
| Player joins | Initialized in tracking system |
| Player quits | Removed from all tracking maps |
Manual Toggle
| Command | Action |
|---|---|
/afk | Toggles AFK on if not AFK, off if already AFK |
Commands
Player Commands
| Command | Description | Permission |
|---|---|---|
/afk | Toggle AFK status | None |
Admin Commands
| Command | Description | Permission |
|---|---|---|
/afk list | List all AFK players | raafkstatus.list |
/afk reload | Reload config files | raafkstatus.reload |
Command Output Examples
/afk (player):
[RA-AfkStatus] You are now marked as AFK.
/afk list:
[RA-AfkStatus] Players currently AFK:
- Steve
- Alex
/afk reload:
[RA-AfkStatus] Config and messages reloaded successfully.
Permissions
| Permission | Default | Description |
|---|---|---|
raafkstatus.list | op | Use /afk list |
raafkstatus.reload | op | Use /afk reload |
Configuration
config.yml
# How many minutes of no movement before a player is marked as AFK
afk-timeout-minutes: 5
# The value shown in %afkstatus_status% when the player is AFK
# Supports & color codes
afk-placeholder-value: "&7[AFK]"
Settings reference:
| Setting | Type | Default | Description |
|---|---|---|---|
afk-timeout-minutes | Integer | 5 | Minutes of no movement before AFK |
afk-placeholder-value | String | &7[AFK] | Placeholder value shown when player is AFK |
messages.yml
# All messages support & color codes
# Use {player} for player name where applicable
prefix: "&8[&bRA-AfkStatus&8] "
afk-auto-enter: "{prefix}&7You are now AFK."
afk-manual-enter: "{prefix}&7You are now marked as AFK."
afk-auto-leave: "{prefix}&aWelcome back!"
afk-manual-leave: "{prefix}&aYou are no longer AFK."
afk-list-header: "{prefix}&ePlayers currently AFK:"
afk-list-entry: "&7- &f{player}"
afk-list-empty: "{prefix}&7No players are currently AFK."
afk-list-no-permission: "{prefix}&cYou do not have permission to use this command."
afk-reload-success: "{prefix}&aConfig and messages reloaded successfully."
afk-reload-no-permission: "{prefix}&cYou do not have permission to reload the config."
Message variables:
| Placeholder | Description |
|---|---|
{prefix} | Plugin message prefix |
{player} | Player name (list entries only) |
Supported color codes:
| Code | Color |
|---|---|
&a | Green |
&c | Red |
&e | Yellow |
&7 | Gray |
&b | Aqua |
&8 | Dark Gray |
&f | White |
PlaceholderAPI
| Placeholder | Returns |
|---|---|
%afkstatus_status% | Value from afk-placeholder-value if AFK, empty string if not |
Usage examples:
Scoreboard:
%afkstatus_status%
Tablist:
%player_name% %afkstatus_status%
Chat format:
%afkstatus_status% %player_name%: %message%
Anti-Piston Abuse
Some servers use pistons or water streams to slightly nudge AFK players, which would falsely reset AFK status on simple position-check plugins.
RA-AfkStatus stores the exact position when the player became AFK. AFK is only removed when the player moves 3 or more blocks (Euclidean distance) from that stored position — preventing pistons, knockback, or minor adjustments from resetting the status.
| Condition | Result |
|---|---|
| Moved less than 3 blocks from AFK position | Stay AFK |
| Moved 3+ blocks from AFK position | AFK removed |
FAQ
How do I change the AFK timeout?
Edit afk-timeout-minutes in config.yml, then run /afk reload.
How do I change the placeholder text?
Edit afk-placeholder-value in config.yml, then run /afk reload.
Can I customize messages?
Yes — edit messages.yml and run /afk reload.
Does this plugin require an island plugin? No, RA-AfkStatus has no dependencies on island or OneBlock plugins.
Does /afk list work from console?
Yes, both players (with permission) and console can use /afk list.
What Paper versions are supported? Paper 1.21, 1.21.1, 1.21.2, 1.21.3, and 1.21.4.
Where is player data stored? In memory only — no flat file storage. Data resets on server restart.