Documentation
Installation:
- Download the Plugin JAR:
Obtain the compiled plugin JAR from the releases section.
- Place in Plugins Folder:
Copy the JAR file into your server’s plugins folder.
- Start or Restart Your Server:
Launch or restart your server. A default config.yml will be generated in the plugin’s folder if one does not already exist.
Configuration:
Open the config.yml file to adjust the messages and title timings. The configuration includes the following sections:
- afk:
Title, subtitle, and animation timings for when a player goes AFK.
- unafk:
Title, subtitle, and animation timings for when a player manually toggles back from AFK.
- move:
Title, subtitle, and animation timings for when a player automatically returns by moving.
- tp-restricted:
Message shown when a player tries to teleport while AFK.
- auto-afk:
Settings for automatic AFK detection, including the timeout (in seconds).
- combatlog:
Settings for combat logging, including the duration (in seconds) during which AFK cannot be toggled after taking damage, and the message displayed.
- disabled-players:
A list of player names for whom auto-AFK is disabled. These settings persist across reloads.
- afk-players:
A list of player names who are currently flagged as AFK. This list is used to reset players to Survival mode upon login and does not persist across sessions.
- commands:
Customizable messages for command feedback (e.g., enabling/disabling auto-AFK, reload confirmations, permission messages).
Each section allows you to customize parameters like title, subtitle, fadeIn, stay, and fadeOut for the title animations.
Usage:
- AFK Toggle:
Players can type /afk to toggle their AFK status manually (switching between Spectator and Survival modes).
- Auto-AFK:
If a player remains inactive for the configured timeout (set in the auto-afk section), they will automatically be set to AFK.
- Movement Reset:
When an AFK player moves or changes their held item, they are automatically returned to Survival mode.
- Combat Log Prevention:
Players cannot toggle AFK if they have recently taken damage. The duration and message for this restriction are configurable.
- Spectator Teleport Restriction:
If a player in AFK mode tries to teleport via Spectator mode (e.g., by pressing a number key), the teleport is canceled and they are removed from AFK.
Commands:
- /afk – Toggle AFK status manually (Spectator ↔ Survival).
- /afk reload – Reload the plugin configuration without a full server restart.
- /afk disable <playerName> – Disable automatic AFK detection for the specified player (admin use).
- /afk enable <playerName> – Re-enable automatic AFK detection for the specified player (admin use).
- /afk auto <enable|disable> – Allow a player to toggle auto-AFK detection for themselves.
- Admin Command:
Admins (or those with the appropriate permission) can type /afk <playerName> to toggle the AFK state of a specific player.
Additional Features:
- Persistent Settings:
The plugin persists disabled auto-AFK settings and resets AFK players on login, ensuring that no one remains in Spectator mode unintentionally after a reload or restart.
- Tab Completion:
Tab completion is supported for subcommands and online player names, making command usage more convenient.