Anti AFK System
A complete Anti-AFK plugin for Minecraft Paper 1.21.10 that automatically detects and kicks inactive players.
Quick challenge
How far can you run before the mobs catch you?
Minecraft check
Confirm your run
Complete the quick check to get your code.
Anti AFK System
AntiAFK Plugin
A complete Anti-AFK plugin for Minecraft Paper 1.21.10 that automatically detects and kicks inactive players.
✨ Features
- 🎯 Broadcast Messages - Detects players who are inactive for too long - ⚠️ Broadcast Messages - Warns players before they get kicked - 🎮 Broadcast Messages - Players can mark themselves as AFK with `/afk` - ⚙️ Broadcast Messages - Customize timeouts, messages and detection - 🛡️ Broadcast Messages - Staff can bypass AFK detection - 📢 Broadcast Messages - Server is informed when players go AFK or return
📋 Requirements
- Java: 1.21.10 - Java: Paper (or forks like Purpur) - Java: 21 or higher
📥 Installation
1. Download the latest `AntiAFK-1.0.0.jar` from releases 2. Place the JAR file in your server's `plugins` folder 3. Restart your server 4. Customize the configuration in `plugins/AntiAFK/config.yml` 5. Use `/afkreload` to reload the configuration
⚙️ Configuration
The configuration is located in `plugins/AntiAFK/config.yml`:
```yaml
Time in seconds before a player is considered AFK
afk-timeout: 300
Time in seconds before the warning is given
warning-time: 270
Check interval in ticks (20 ticks = 1 second)
check-interval: 100
Messages (use & for color codes)
messages: kick: "&cYou have been kicked for inactivity!" warning: "&eWarning: You will be kicked in {time} seconds for inactivity!" afk-enabled: "&7You are now AFK" afk-disabled: "&7You are no longer AFK" player-afk: "&7{player} is now AFK" player-back: "&7{player} is back" reload: "&aConfiguration reloaded!" no-permission: "&cYou don't have permission to do this!"
Actions that reset AFK status
detect-movement: true detect-chat: true detect-block-break: true detect-block-place: true detect-interact: true detect-damage: true ```
Configuration Options
| Option | Default | Description | |--------|---------|-------------| | `afk-timeout` | 300 | Seconds before player gets kicked | | `warning-time` | 270 | Seconds before warning is given | | `check-interval` | 100 | Ticks between each check (20 = 1 sec) | | `detect-movement` | true | Detect movement as activity | | `detect-chat` | true | Detect chat as activity | | `detect-block-break` | true | Detect block breaking as activity | | `detect-block-place` | true | Detect block placing as activity | | `detect-interact` | true | Detect interactions as activity | | `detect-damage` | true | Detect damage as activity |
🎮 Commands
| Command | Description | Permission | |---------|-------------|------------| | `/afk` | Toggle your AFK status manually | `antiafk.command` | | `/afkreload` | Reload the plugin configuration | `antiafk.reload` |
🔐 Permissions
| Permission | Default | Description | |------------|---------|-------------| | `antiafk.command` | true | Use the `/afk` command | | `antiafk.bypass` | op | Bypass AFK detection (for staff) | | `antiafk.reload` | op | Reload the configuration |
Permission Examples
LuckPerms: ```bash
Give moderators bypass permission
lp group moderator permission set antiafk.bypass true
Give admins reload permission
lp group admin permission set antiafk.reload true ```
🔍 How it Works
1. Broadcast: The plugin tracks when players were last active 2. Broadcast: Every X ticks (configurable) it checks if players have been inactive too long 3. Broadcast: At `warning-time` seconds the player receives a warning 4. Broadcast: At `afk-timeout` seconds the player gets kicked 5. Broadcast: Other players are informed when someone goes AFK or returns
Detected Activities
The plugin detects the following activities (if enabled in config): - ✅ Movement (position change, not just head rotation) - ✅ Chat messages - ✅ Breaking blocks - ✅ Placing blocks - ✅ Interactions (buttons, doors, etc.) - ✅ Taking damage - ✅ Executing commands
📝 Examples
Example 1: Default Usage
``` Player is inactive for 4 minutes → At 4:30 minutes: "⚠️ Warning: You will be kicked in 30 seconds for inactivity!" → At 5:00 minutes: Player gets kicked ```
Example 2: Manual AFK
``` Player: /afk → "You are now AFK" → Server: "Player123 is now AFK"
Player moves → "You are no longer AFK" → Server: "Player123 is back" ```
Example 3: Staff Bypass
``` Staff with antiafk.bypass permission → Never gets kicked, regardless of inactivity ```
🐛 Troubleshooting
Players are not getting kicked: - Check if `afk-timeout` is set correctly - Verify players don't have `antiafk.bypass` permission - Verify the plugin is loaded correctly with `/plugins`
Warnings don't work: - Make sure `warning-time` is less than `afk-timeout` - Check the console for errors
Config changes don't work: - Use `/afkreload` after editing the config - Or restart the server
📄 License
This project is open source and available for personal and commercial use.
---
Made with ❤️ for the Minecraft community