AntiAFK - The Performance AFK Solution
AntiAFK is a next-gen AFK management tool. With behavior analysis, macro detection, and Captcha tests, it blocks the most complex bots and exploits. Its high-performance design provides fair protection without overloading your server.
AntiAFK - The Performance AFK Solution
<div align="center"> <img width="55%" src="https://i.imgur.com/QK50QUt.png" alt="AntiAFK Banner">
Smart, Performance-Focused, and Comprehensive AFK Management System
</div>
---
<div align="center">
AntiAFK is a next-generation management tool designed for modern Minecraft servers where standard AFK timers fall short. Its primary goal is not only to detect AFK players but also to proactively prevent the most complex bots and attempts to exploit AFK detection. With a design that prioritizes server performance, it operates unnoticed even on the busiest servers.
Visuals
Orbital Detection System (Behavior Analysis) <details> <summary>Orbital Detection System visuals.</summary> <img src="https://i.imgur.com/JfUVizh.gif" alt="Orbital Detection System 1"> <img src="https://i.imgur.com/FeHWuth.gif" alt="Orbital Detection System 2">
Repeating Pointless Movements Continuously in the Same Block (Pointless Activity Analysis)
Pointless Activity System visuals.
<img src="https://i.imgur.com/MdHmYiN.gif" alt="Pointless Activity System 1"> <img src="https://i.imgur.com/1gkH9CF.gif" alt="Pointless Activity System 2">
GUI Display:
GUI System images.
<img src="https://i.imgur.com/QHWL44L.gif" alt="GUI System">
</details> </div>
---
<div align="center">
✨ Key Features ✨
</div>
🧠 "Learning Mode": Intelligent Pattern Recognition
Leveraging machine learning principles, Learning Mode detects and counteracts sophisticated AFK bots that follow predefined movement patterns or routes. This system goes beyond simple activity checks to analyze how players move over time. A highly optimized, asynchronous task continuously compares the recent movements of all online players against a library of known bot patterns using the Dynamic Time Warping (DTW) algorithm, which effectively compares two movement sequences even if they are performed at different speeds. * Dual Serialization Formats: A custom-built task runs entirely off the main server thread to perform computationally intensive DTW comparisons, ensuring zero server lag. * Dual Serialization Formats: Implements object pooling (Apache Commons Pool2) to significantly reduce garbage collection overhead and uses a lock-free queue to safely pass data between threads. * Dual Serialization Formats: A new command suite, `/antiafk pattern`, gives you full control to record, list, and manage bot patterns. * Dual Serialization Formats: Patterns can be saved in human-readable JSON (for debugging) or a highly efficient binary Kryo format for optimal performance.
Multi-Layered Detection Architecture
AntiAFK applies a four-layered analysis to detect AFK behavior and bots that mimic it: * Layer 4: Asynchronous Behavioral Analysis: Monitors over 10 basic actions, including movement, chat, inventory, and world interaction. * Layer 4: Asynchronous Behavioral Analysis: Counts non-movement actions repeated by the player while staying at the same block coordinates. When the threshold is exceeded, these actions are prevented from resetting the AFK timer. * Layer 4: Asynchronous Behavioral Analysis: Detects clicking patterns that are too consistent to be human (Auto-Clicker) and exploits involving very fast position changes using portals/commands. * Layer 4: Asynchronous Behavioral Analysis: Analyzes players' movement trajectories asynchronously, catching even bots that follow the most complex trajectories along a specific route.
“Turing Test” (Captcha Protection)
When suspicious behavior is detected, AntiAFK challenges the player: * Customizable Penalties: Automatically activate based on suspicious trajectory repetition or pointless action counts. * Customizable Penalties: Asks the player a random question from `questions.yml` to verify they are human. Supports multiple correct answers for each question. * Customizable Penalties: While a test is active, the bot's movements or clicks cannot reset the AFK timer, making it impossible for bots to bypass the test. * Customizable Penalties: You can define custom commands such as `kick` or `ban` for players who fail the test.
Graduated Penalty and Record System
Provides a fair and effective penalty system: * Automatic Penalty Reset: Players' entire AFK history (number of penalties, total AFK time, captcha statistics) is permanently stored on the server. * Automatic Penalty Reset: For repeated AFK behavior, you can configure actions (warning, kick, temporary ban, etc.) that increase in severity based on the number of penalties. * Automatic Penalty Reset: The records of players who have not caused problems for a long time are automatically cleared after a specified period.
🌍 Full Internationalization (i18n) Support
AntiAFK now speaks your language! The entire plugin has been overhauled to provide a truly multilingual experience. * Easy Translation: Every single message, including system logs, error messages, and in-game commands, is managed by the language system. * Easy Translation: Set the global language for all console output directly in `config.yml` using the `lang` setting. * Easy Translation: Comes with full support for Easy Translation:. * Easy Translation: To change the language for player-facing messages, simply replace your `messages.yml` file with one from the provided language files. You can find all official translations <a href="https://github.com/bentahsin/AntiAFK/blob/master/messages_yml/">here</a>.
Comprehensive Management and Configuration
Provides full control to server owners: * Flexible Configuration: Provides access to all management tools through a single main command (`/antiafk`). * Flexible Configuration:: Opens a fully featured GUI to manage the plugin from within the game. * Flexible Configuration:: Reloads all configuration files. * Flexible Configuration:: Queries a player's detailed record and current status. * Flexible Configuration:: Displays AFK leaderboards. * Flexible Configuration:: Lists players who are currently AFK. * Flexible Configuration:: Manage the "Learning Mode" bot detection patterns. * Flexible Configuration: All texts, commands, announcements, penalties, and detection mechanisms can be configured in detail via the `config.yml`, `messages.yml`, and `questions.yml` files.
---
<div align="center">
🚀 Performance
</div>
AntiAFK has been developed using the most modern techniques to keep its impact on server performance to an absolute minimum. It doesn't just show results, it transparently reveals how it achieves them:
* Distributed Load: Computationally expensive operations, such as the behavioral and pattern analysis (DTW algorithm) and all database interactions, are executed entirely outside the server's main thread. This prevents disk I/O or intensive CPU usage from affecting the server's tick rate (TPS). * Distributed Load: Frequently accessed data (player statistics, configuration values) is stored in high-performance caches to minimize database queries and file reads. * Distributed Load: Periodic tasks spread their operations evenly across 20 ticks within a one-second timeframe, preventing sudden performance spikes on the server during high player counts.
Performance Profile (Spark Analysis)
Test Environment: Paper 1.19.4, 1 online player, standard server load.
```
// Server's overall idle rate (higher is better) Server thread: 100.00% └── net.minecraft.server.MinecraftServer.waitUntilNextTick(): 85.37%
// Plugin's total impact on the main thread AntiAFK (v1.0.2) └── Server thread: 0.24% ├── com.bentahsin.antiafk.tasks.AFKCheckTask.run(): 0.18% ├── com.bentahsin.antiafk.listeners.handlers.PlayerMovementListener.onPlayerMove(): 0.04% └── Other (Commands, GUI, Captcha): 0.02%
``` ~0.24% * The fact that the server spends ~0.24% indicates that the plugin does not negatively impact overall server health. * The total impact of all plugin components on the main thread is only ~0.24%. This is a statistically negligible value, confirming that it will not create a noticeable impact on TPS even on the busiest servers.
---
<div align="center">
🔗 Integrations and Installation
</div>
ProtocolLib: * ProtocolLib: Allows you to define completely different AFK durations and penalty actions for specific areas (arena, market, AFK room, etc.). (Optional) * ProtocolLib: Share dynamic data such as `%antiafk_tag%`, `%antiafk_reason%` with other plugins. (Optional) * ProtocolLib: Offers a more advanced user experience for features like text input within the GUI. (Optional)
Installation: 1. Download the latest version Installation:. 2. Place the `.jar` file in your server's `plugins` folder. 3. Start the server to generate the default configuration files (`config.yml`, `messages.yml`, `questions.yml`, `playerdata.db`). 4. Customize the configuration files as needed and use the `/antiafk reload` command.
<div align="center"> If you encounter any issues with the plugin or have feature suggestions, please use the <strong>GitHub Issues</strong> page.<br> <a href="https://github.com/bentahsin/antiafk">GitHub Page</a> | <a href="https://github.com/bentahsin/antiafk/issues">Report an Issue</a> </div>