bizon02155

Create a Minecraft AntiCheat plugin named "ZenAC" with package me.zen.zenac, using Java 21 and supporting Minecraft 1.21+. The plugin must be compatible with Paper, Spigot, and Folia servers.

This is an AI-powered anti-cheat where the admin configures AI API keys (OpenAI, Google Gemini, Anthropic Claude, or custom endpoints) in config.yml. The plugin sends player actions to the AI for real-time analysis and cheat detection, with support for multiple API keys for load balancing and fallback.

=== ARCHITECTURE ===

me.zen.zenac/ ├── ZenAC.java (main plugin class) ├── api/ │ ├── AIProvider.java (interface for AI providers) │ ├── OpenAIProvider.java │ ├── GeminiProvider.java │ ├── ClaudeProvider.java │ ├── CustomAPIProvider.java │ ├── APIKeyManager.java (manages multiple keys) │ └── LoadBalancer.java (distributes requests) ├── monitor/ │ ├── ActionCollector.java (collects player actions) │ ├── ActionBuffer.java (buffers actions before sending) │ ├── BatchProcessor.java (processes and sends batches to AI) │ └── AnalysisCache.java (caches AI results) ├── action/ │ ├── ActionType.java (enum: MOVE, ATTACK, BLOCK_PLACE, etc.) │ ├── GameAction.java (action data structure) │ └── ActionSerializer.java (converts actions to JSON) ├── learning/ │ ├── FalsePositiveLearner.java (learns from false positives) │ ├── PromptUpdater.java (updates AI prompt with feedback) │ └── FeedbackCollector.java (stores false positive cases) ├── integration/ │ ├── LiteBansHook.java (auto-ban integration) │ ├── LuckPermsHook.java (rank/suspect tag integration) │ ├── PlaceholderAPIHook.java (provides placeholders) │ └── VaultHook.java (fine system) ├── check/ │ ├── AICheck.java (main AI analysis check) │ ├── MovementCheck.java (fallback movement checks) │ ├── CombatCheck.java (fallback combat checks) │ └── PlayerCheck.java (fallback player checks) ├── alert/ │ └── AlertManager.java (in-game alerts) ├── commands/ │ └── ZenACCommand.java (all plugin commands) └── utils/ ├── HttpUtils.java (HTTP requests to AI APIs) ├── RateLimiter.java (prevents spam) └── ConfigManager.java (handles configuration)

=== CORE FEATURES ===

  1. MULTIPLE AI API SUPPORT (admin configured):

- OpenAI (GPT-4, GPT-3.5) - Google Gemini - Anthropic Claude - Custom API endpoint (any JSON-compatible API)

  1. AUTO-LEARNING FROM FALSE POSITIVES:

- Admin command: /zenac false <player> marks a false positive - Stores the player's last 30 seconds of actions - AI automatically adjusts detection thresholds for that check type - False positive cases are added to the prompt to prevent recurrence - Command: /zenac feedback list shows all recorded false positives - Command: /zenac feedback clear clears feedback data - Data saved to false_positives.yml

  1. PLUGIN INTEGRATIONS:

- LiteBans / AdvancedBan: * Auto-ban when AI confidence > 0.95 * Command: /zenac ban <player> bans with AI evidence - LuckPerms: * Auto-assign "suspect" tag to players with high violations * Temporary rank demotion configurable - PlaceholderAPI: * Placeholders: %zenac_violations%, %zenac_status% - Vault: * Fine players instead of banning (configurable amount per cheat type)

  1. MULTI-API KEY MANAGEMENT:

- Load balancing: round-robin, least-used - Automatic fallback when a key hits rate limit or fails - Quota tracking per API key - Command: /zenac stats shows quota remaining and request counts

  1. PLAYER ACTION COLLECTION:

- Collects actions in real-time: * Movement: position, speed, direction, jumping, falling * Combat: target, distance, damage, crit, knockback * Block actions: place, break, block type, time * Item usage: item type, right/left click * Damage taken: source, amount, type - Each action includes timestamp, location, and world

  1. AI ANALYSIS PROCESSING:

- Batches actions (5-10 per batch) to reduce API calls - Sends every 2-3 seconds or when batch is full - Prompt template with embedded false positive feedback:

yaml
# ZenAC Configuration

ai:
  enabled: true
  provider: openai  # openai, gemini, claude, custom
  timeout: 5000  # milliseconds
  
  # Multiple API keys for load balancing
  api_keys:
    openai:
      - key: "sk-xxxxx1"
        quota_limit: 100000  # tokens
      - key: "sk-xxxxx2"
        quota_limit: 100000
    gemini:
      - key: "AIzaSyxxxxx1"
      - key: "AIzaSyxxxxx2"
    claude:
      - key: "sk-ant-xxxxx1"
    custom:
      url: "https://your-api.com/analyze"
      headers:
        Authorization: "Bearer token"
  
  load_balancing: round_robin  # round_robin, least_used
  fallback_to_rule: true
  
  batch:
    size: 5  # actions per batch
    interval: 3  # seconds between batches

# False Positive Learning
false_positive:
  enabled: true
  auto_adjust_threshold: true
  save_path: "plugins/ZenAC/false_positives.yml"

# Plugin Integrations
integration:
  LiteBans:
    enabled: true
    auto_ban: true
    ban_threshold: 0.95
    ban_reason: "Cheat detected by ZenAC AI"
  
  LuckPerms:
    enabled: true
    suspect_tag: "suspect"
    rank_demote_on_violations: 5
  
  PlaceholderAPI:
    enabled: true
  
  Vault:
    enabled: true
    fine_amount: 1000
    fine_on_violations: 3

# Action Collection
action_collection:
  max_actions_per_player: 50  # stored actions before sending
  send_interval: 3  # seconds
  include:
    - movement
    - combat
    - block_place
    - block_break
    - item_use

# Detection
detection:
  confidence_threshold:
    warn: 0.7
    kick: 0.85
    ban: 0.95
  auto_punish: false  # if false, only alerts
  max_violations_before_ban: 10  # cumulative violations count

# Rate Limit
rate_limit:
  requests_per_player_per_minute: 12
  requests_global_per_minute: 100

# Alerts
alerts:
  in_game: true
  alert_format: "&c[ZenAC] &f{player} &7failed &c{check} &7(Confidence: {confidence}%)"
  alert_delay: 5  # seconds between alerts for same player

# Logging
logging:
  log_file: "logs/zenac.log"
  log_actions: false  # warning: can be large
  log_api_calls: true
  log_punishments: true

# Database
database:
  type: sqlite  # sqlite or mysql
  mysql:
    host: localhost
    port: 3306
    database: zenac
    username: root
    password: ""

  1. RESULT HANDLING:

- Confidence ≥ 0.7 → in-game alert - Confidence ≥ 0.85 → auto-kick (configurable) - Confidence ≥ 0.95 → auto-ban via LiteBans (configurable) - Results cached for 5 minutes to avoid duplicate API calls

  1. FALLBACK MECHANISM:

- If AI API fails to respond → use rule-based checks - If all API keys hit quota → disable AI mode, use rule-based - Admin receives console notification when fallback activates

  1. RATE LIMITING:

- Per player: max 1 request every 5 seconds - Global: max 100 requests per minute (configurable) - Prevents API abuse and quota exhaustion

  1. COMMANDS & PERMISSIONS:

Admin commands:

  • /zenac reload - Reload config
  • /zenac stats - Show API statistics (quota, requests, detections)
  • /zenac test <player> - Test AI on a player's recent actions
  • /zenac false <player> - Mark as false positive (AI learns)
  • /zenac feedback list - List all false positive cases
  • /zenac feedback clear - Clear feedback data
  • /zenac toggle <player> - Enable/disable AI monitoring for a player
  • /zenac queue - Show pending API request queue
  • /zenac ban <player> - Ban player with AI evidence

Player commands:

  • /zenac - Show plugin info and personal stats

Permissions:

  • zenac.admin - All admin commands
  • zenac.alerts - Receive in-game alerts

=== CONFIGURATION (config.yml) ===

code

You are a Minecraft cheat detection expert.
Analyze this player's action sequence from the last [X] seconds:
[JSON actions]

Return JSON response:
{
"is_cheating": true/false,
"cheat_type": "fly/speed/killaura/reach/autoclicker/scaffold/timer/none",
"confidence": 0.0-1.0,
"reason": "detailed explanation",
"evidence": ["evidence 1", "evidence 2"]
}

=== TECHNICAL REQUIREMENTS ===

· Java 21 · Minecraft 1.21+ (Paper, Spigot, Folia compatible) · Async processing for all API calls (never block main thread) · Thread-safe for Folia's regionized threading · Request queue system to prevent overwhelming APIs · Clean, well-commented code · MySQL and SQLite support for storing violations and statistics

Write the complete source code for this plugin.

``

---

📋 Summary

| Item | Detail | |------|--------| | Plugin Name | ZenAC | | Package | me.zen.zenac` | | Minecraft Version | 1.21+ | | Server Platforms | Paper, Spigot, Folia | | Java Version | 21 | | AI Providers | OpenAI, Google Gemini, Anthropic Claude, Custom |

Kodari AI
KodariMar 21 at 11:55 pm 18,100 (v2)

I’ll create a comprehensive AI-powered anti-cheat plugin with multiple AI provider support, auto-learning from false positives, and extensive integration capabilities.

ZenAC
An advanced AI-powered anti-cheat plugin for Minecraft 1.21+ that leverages OpenAI, Google Gemini, Anthropic Claude, or custom APIs for real-time cheat detection. Features intelligent load balancing across multiple API keys, automatic learning from false positives, batch action processing, and seamless integration with LiteBans, LuckPerms, PlaceholderAPI, and Vault. Includes fallback rule-based checks, comprehensive caching, rate limiting, and full Folia compatibility.

[Generation stopped]

bizon02155

== LANGUAGE SUPPORT === The plugin supports two languages: Vietnamese (vi) and English (en).

Language files are stored in: plugins/ZenAC/lang/vi.yml and plugins/ZenAC/lang/en.yml Admin can switch language in config.yml: language: en or language: vi All messages, alerts, command responses, and INVENTORY GUI texts load from the selected language file If a translation key is missing, fallback to English Example language file structure (en.yml): yaml Copy prefix: "&8[&bZenAC&8]&r " commands: reload: success: "&aConfiguration reloaded successfully!" failed: "&cFailed to reload configuration!" stats: title: "&6=== ZenAC Statistics ===" api_calls: "&eTotal API calls: &f{calls}" quota_left: "&eQuota remaining: &f{quota}" alert: cheat: "&c{player} &7failed &c{check} &7(Confidence: {confidence}%)" kick: "&c{player} &7was kicked for &c{cheat_type}" ban: "&c{player} &7was banned for &c{cheat_type}" messages: no_permission: "&cYou don't have permission to use this command!" player_not_found: "&cPlayer not found!" api_failed: "&cAI API request failed! Using fallback checks." monitoring_disabled: "&eMonitoring for {player} is now &cdisabled" monitoring_enabled: "&eMonitoring for {player} is now &agreen" false_positive_marked: "&aFalse positive marked for {player}. AI will learn from this." feedback_list_header: "&6=== False Positive Cases ===" feedback_list_empty: "&7No false positive cases recorded." ban_evidence: "&eEvidence: &f{reason}" Example language file structure (vi.yml):

```yaml prefix: "&8[&bZenAC&8]&r " commands: reload: success: "&aCấu hình đã được tải lại thành công!" failed: "&cKhông thể tải lại cấu hình!" stats: title: "&6=== Thống kê ZenAC ===" api_calls: "&eTổng số lần gọi API: &f{calls}" quota_left: "&eHạn mức còn lại: &f{quota}" alert: cheat: "&c{player} &7đã gian lận &c{check} &7(Độ tin cậy: {confidence}%)" kick: "&c{player} &7đã bị kick vì &c{cheat_type}" ban: "&c{player} &7đã bị ban vì &c{cheat_type}" messages: no_permission: "&cBạn không có quyền sử dụng lệnh này!" player_not_found: "&cKhông tìm thấy người chơi!" api_failed: "&cYêu cầu AI API thất bại! Đang sử dụng kiểm tra dự phòng." monitoring_disabled: "&eGiám sát cho {player} đã &ctắt" monitoring_enabled: "&eGiám sát cho {player} đã &abật" false_positive_marked: "&aĐã đánh dấu false positive cho {player}. AI sẽ học từ điều này." feedback_list_header: "&6=== Danh sách False Positive ===" feedback_list_empty: "&7Chưa có trường hợp false positive nào." ban_evidence: "&eBằng chứng: &f{reason}"

Kodari AI
KodariMar 21 at 11:59 pm 16,284 (v2)

I’ll add comprehensive language support to the plugin. Let me first read the existing files to understand the current structure.

I’ll implement comprehensive language support for the ZenAC plugin. Let me create the necessary files:

bizon02155

Is it possible to build it using Maven?

Kodari AI
KodariMar 22 at 12:34 am 5,047 (v2)

I’ll check the current build configuration to give you a complete answer.

Yes, it’s technically possible to build any Java project with Maven. You would need to create a pom.xml file with equivalent dependencies and configuration.

However, the project is currently set up for Gradle, which is the standard for modern Minecraft plugins and handles dependencies more efficiently (especially with the Paper maven repository and JitPack).

If you want to convert to Maven, I can:

  1. Create a pom.xml with equivalent dependencies to the current build.gradle

  2. Keep both build files (so you can use either)

  3. Or replace Gradle entirely with Maven

Current Gradle dependencies that would need Maven equivalents:

  • Paper API (from Paper’s maven repo)

  • PlaceholderAPI, LuckPerms, Vault, LiteBans (compileOnly)

  • Gson (implementation)

  • Lombok (compileOnly + annotation processor)

Would you like me to:

  • Create a pom.xml for Maven support?

  • Create both (keep Gradle + add Maven)?

  • Just keep using Gradle as-is?

Keep in mind that Gradle is generally preferred for Bukkit/Paper plugins because it handles shading/relocation better and has cleaner dependency management for multi-version support.

bizon02155
1 image attached
Kodari AI
KodariMar 22 at 12:35 am 6,601 (v2)

I can see compilation errors for a project called lightrtpq (not the ZenAC project shown in the structure). The errors indicate:

  1. Missing FoliaLib dependency - used in QueueManager.java and TeleportManager.java

  2. Missing XSeries dependency - used in QueueGUI.java

Let me read the relevant files to understand the project structure and fix these issues:

The project structure shows package me.zen.zenac, but your errors reference com.yaannghi.lightrtpq. Let me search for the actual files:

Based on the errors shown, you need to add FoliaLib and XSeries dependencies to your build.gradle. The current build.gradle is missing these libraries that your code is importing.

Fixed:

  • Added FoliaLib dependency (com.github.Anon8281:FoliaLib:0.3.1)

  • Added XSeries dependency (com.github.cryptomorin:XSeries:11.2.0.1)

  • Added CodeMC repository for XSeries

Run gradle build again and the compilation errors should be resolved.

bizon02155
1 image attached
Kodari AI
KodariMar 22 at 1:03 am 6,739 (v2)

I can see the Gradle build is failing because of an issue with the sourceCompatibility property on line 7 of build.gradle. Let me read the file to diagnose and fix the issue.

The issue is that sourceCompatibility and targetCompatibility are conflicting with the java.toolchain configuration. Since you’re already using the modern toolchain approach (which is better), you should remove the redundant compatibility lines.

Fixed! I removed the sourceCompatibility and targetCompatibility lines (lines 7-8) since you’re already using the modern java.toolchain configuration which handles Java version management better. Now run gradle build again and it should compile successfully.

bizon02155

Fix bug

Kodari AI
KodariMar 22 at 2:38 am 3,528 (v2)

I’ll analyze the project to identify bugs. Let me read the key files first.

[Generation stopped]

bizon02155

Is it possible to build it using Maven?

Kodari AI
KodariMar 22 at 2:44 am 4,670 (v2)

Yes, it’s technically possible to convert this project to Maven, but I strongly recommend keeping Gradle for this project because:

  1. Already configured: The project is set up with Gradle and working correctly

  2. Modern Minecraft development: Gradle is the standard build tool for modern Minecraft plugins (Paper, Spigot, etc.)

  3. Better dependency management: Gradle handles transitive dependencies and repository resolution more efficiently

  4. Faster builds: Gradle’s incremental compilation and caching make builds significantly faster

However, if you have a specific reason to use Maven (like IDE preference or organizational requirements), I can create a pom.xml file that mirrors the current Gradle configuration. The equivalent Maven file would include:

  • Java 21 toolchain

  • Paper API, PlaceholderAPI, Vault, LuckPerms, LiteBans, FoliaLib dependencies (all scope: provided)

  • XSeries (scope: provided)

  • Gson (scope: compile)

  • Lombok (scope: provided with annotation processor)

Would you like me to create a pom.xml file to enable Maven builds?

Note: If converted to Maven, you’d lose some of Gradle’s advantages like faster incremental builds and better multi-project support, but the plugin would function identically.

bizon02155

Yes using maven

Kodari AI
KodariMar 22 at 6:15 am 6,907 (v2)

I’ll convert the project from Gradle to Maven by creating a pom.xml and removing the build.gradle.

Converting to Maven structure:

Converted project from Gradle to Maven with pom.xml, manifest.kod for Gson dependency, and removed build.gradle.

Kodari can make mistakes. Review important code before using.
Files
src
manifest.kod
pom.xml
Code
38 2,460
src/main/java/me/zen/zenac/ZenAC.java
package me.zen.zenac;

import lombok.Getter;
import me.zen.zenac.alert.AlertManager;
import me.zen.zenac.integration.LiteBansHook;
import me.zen.zenac.integration.LuckPermsHook;
import me.zen.zenac.integration.PlaceholderAPIHook;
import me.zen.zenac.integration.VaultHook;
import me.zen.zenac.learning.FalsePositiveLearner;
import me.zen.zenac.learning.FeedbackCollector;
import me.zen.zenac.learning.PromptUpdater;
import me.zen.zenac.monitor.ActionBuffer;
import me.zen.zenac.monitor.ActionCollector;
import me.zen.zenac.monitor.BatchProcessor;
import me.zen.zenac.check.AICheck;
import me.zen.zenac.check.CombatCheck;
import me.zen.zenac.check.MovementCheck;
import me.zen.zenac.check.PlayerCheck;
import me.zen.zenac.utils.ConfigManager;
import me.zen.zenac.utils.LanguageManager;
import org.bukkit.plugin.java.JavaPlugin;

public class ZenAC extends JavaPlugin {

    @Getter private ConfigManager configManager;
    @Getter private LanguageManager languageManager;
    @Getter private AlertManager alertManager;
    @Getter private ActionBuffer actionBuffer;
    @Getter private ActionCollector actionCollector;
    @Getter private AICheck aiCheck;
    @Getter private MovementCheck movementCheck;
    @Getter private CombatCheck combatCheck;
    @Getter private PlayerCheck playerCheck;
    @Getter private BatchProcessor batchProcessor;
    @Getter private FalsePositiveLearner falsePositiveLearner;
    @Getter private FeedbackCollector feedbackCollector;
    @Getter private PromptUpdater promptUpdater;
    @Getter private LiteBansHook liteBansHook;
    @Getter private LuckPermsHook luckPermsHook;
    @Getter private PlaceholderAPIHook placeholderAPIHook;
    @Getter private VaultHook vaultHook;

    @Override
    public void onEnable() {
        // Initialize managers
        this.configManager = new ConfigManager(this);
        this.languageManager = new LanguageManager(this);
        this.actionBuffer = new ActionBuffer(configManager.getMaxActionsPerPlayer());
        
        // Initialize checks
        this.movementCheck = new MovementCheck(this);
        this.combatCheck = new CombatCheck(this);
        this.playerCheck = new PlayerCheck(this);
        
        // Initialize other components
        this.aiCheck = new AICheck(this, movementCheck, combatCheck, playerCheck);
        this.actionCollector = new ActionCollector(this, actionBuffer);
        this.batchProcessor = new BatchProcessor(this, actionBuffer, null, null, null, aiCheck, configManager.getBatchSize());
        this.feedbackCollector = new FeedbackCollector();
        this.promptUpdater = new PromptUpdater();
        this.falsePositiveLearner = new FalsePositiveLearner(this, feedbackCollector, promptUpdater);
        
        // Initialize hooks
        this.liteBansHook = new LiteBansHook(this);
        this.luckPermsHook = new LuckPermsHook(this);
        this.placeholderAPIHook = new PlaceholderAPIHook(this);
        this.vaultHook = new VaultHook(this);
        
        // Initialize alert manager
        this.alertManager = new AlertManager(this);
        
        // Load configurations
        configManager.loadConfigs();
        languageManager.loadLanguage();
    }

    @Override
    public void onDisable() {
        // Cleanup code here
    }
}