AntiAFKPlugin – Documentation
Version: 1.1
Author: McGovernn
Spigot/Paper: 1.20 – 1.21+
Main class: net.McGovernn.antiAFKPlugin.AntiAFKPlugin
Overview
AntiAFKPlugin automatically detects inactive players and executes a configurable command after a set time (e.g. teleporting them to spawn). The plugin includes optional sound effects, tab completion, and admin tools – fully customizable.
⚙️ Configuration (config.yml)
yaml
afk-time-seconds: 60 # Time in seconds before the command is executed
afk-command: spawn # Command executed AS the player (no slash needed)
messages:
prefix: "§e[AntiAFK] "
afk-warning: "You were AFK too long. Executing command..."
reload-success: "Config reloaded successfully."
info: "§7AntiAFKPlugin v1.1 by McGovernn"
check-usage: "§cUsage: /antiafk check <player>"
check-yes: "%player% is currently §cAFK§7."
check-no: "%player% is currently §aactive§7."
player-not-found: "§cPlayer not found."
no-permission: "§cYou don’t have permission for that command."
only-player: "§cOnly players can use this command."
sound:
enabled: true
type: BLOCK_NOTE_BLOCK_BELL # Sound played on AFK trigger
volume: 1.0
pitch: 1.0
Behavior
- AFK detection based on:
- No movement
- No chat
- No interaction
- Once AFK:
- Executes configured command as the player
- Plays sound effect (if enabled)
- Sends warning message
- Timer only resets when player becomes active again
- Command will not repeat while player is still AFK
️ Commands
Command
Description
Permission
/antiafk Shows plugin info antiafk.use
/antiafk reload Reloads config.yml antiafk.use
/antiafk check <player> Checks if a player is currently AFK antiafk.use
/antiafk info Shows version and credits antiafk.use
✨ Tab Completion
Usage
Suggestions
/antiafk <TAB> reload, check, info
/antiafk check <TAB> All currently online player names
Permissions
yaml
antiafk.use:
description: Allows using /antiafk commands
default: op
✅ Plugin Goals
- Prevent AFK farms and auto-clicker abuse
- Automatically teleport inactive players
- Fully customize all plugin behavior
- Simple setup, lightweight performance impact
- Built-in admin tools for control and debugging
Setup
- Drop the plugin into /plugins
- Restart or reload your server
- Adjust config.yml to your needs
- Done ✅
Ideas for Expansion
- PlaceholderAPI support (%antiafk_status%)
- Bypass permission for trusted players
- Per-world AFK settings
- ActionBar or BossBar support
- Integration with Vanish plugins
Credits
Plugin by
McGovernn
Proudly made for
Stadtsucht.net
Need help or want to contribute? Reach out on Discord or Spigot.