moizgamer23
📎 1 file 7,829 chars
📄
pasted-code-1786818882296.txt
txt 119 lines
▶
Build a production-quality, highly advanced server-side Minecraft Anti-Cheat plugin named AegisAC for Paper.

### Platform & Compatibility
- Paper only
- Minecraft 1.21.x → latest supported version
- Java 21+ (as required by target Paper version)
- Maven or Gradle
- Fully modular architecture
- Version-adapter system (isolate all version-specific packet/NMS code)
- Prefer stable Bukkit/Paper APIs
- Packet layer via ProtocolLib or a clean internal abstraction

Do not hard-code the plugin to a single Minecraft version.

### Core Philosophy
No single check is trusted. Build a layered detection engine:

1. Packet analysis
2. Movement physics analysis
3. Rotation analysis
4. Combat analysis
5. Interaction analysis
6. Inventory analysis
7. Block/world interaction analysis
8. Player-behavior analysis
9. Statistical / long-term behavior analysis
10. Violation-level system with decay
11. Cross-check correlation
12. Server-authoritative validation

Every check must include:
- Confidence score
- Violation level contribution
- Evidence recording
- Configurable threshold
- Decay
- False-positive safeguards
- Exemptions
- Debug mode

Never instantly ban from one suspicious event.

### Absolute Non-Punishable Features (Critical – Never Ban/Kick for these alone)

These are explicitly allowed and must never cause a flag, kick, ban, or punishment by themselves:

- Drag clicking
- Butterfly clicking
- Jitter clicking
- High CPS / double-clicking mice / any legitimate high-input-rate technique
- Custom / visual hitbox mods
- Cosmetic crosshair mods
- Legal resource packs
- Cosmetic client modifications
- Normal Minecraft PvP techniques

Rules:
- High CPS is telemetry only, never automatic proof of cheating.
- Do not cancel legitimate clicks just because CPS is high.
- Separate input frequency from automated attack behavior.
- Detect AutoClicker / FastClick only when multiple independent signals show automation (artificial timing distributions, impossible action timing, packet anomalies, or behavior inconsistent with server state).
- Custom hitbox mods are not cheats. Only flag an actual server-invalid combat interaction when there is strong independent evidence the player is exploiting a modified hitbox to perform an impossible action. Never punish merely for the presence or suspicion of a custom hitbox or crosshair mod.
- Never detect, flag, kick, or ban for cosmetic crosshair modifications.

If the server cannot prove the player performed an impossible or illegal action, do not punish. Prefer monitoring + evidence + VL decay.

### Detection Areas (implement all with the above safeguards)

Movement: Fly, Creative fly abuse, AirWalk, NoFall, Speed, BunnyHop, Jesus/WaterWalk, Step, HighJump, LongJump, Glide, SlowFall abuse, Spider/WallClimb, Phase/NoClip, invalid movement, impossible acceleration/deceleration/jump height/horizontal distance/vertical movement, ground/air spoofing, Timer, tick manipulation, packet flood/ordering anomalies, repeated identical patterns, impossible friction/velocity handling.

Account for (and never false-flag): slime, honey, ice, blue ice, soul sand/speed, bubble columns, water, lava, pistons, explosions, knockback, tridents, elytra, boats, minecarts, horses, all relevant potion effects, Riptide, Wind Charges, Mace, server lag, high ping, packet loss.

Combat: KillAura, AimAssist, AimBot, AutoClicker (multi-signal only), Reach, Hitbox (only server-invalid interactions), Criticals, Velocity/AntiKnockback, FastAttack, MultiAura, impossible rotations/angles/timing/distance, attack through walls, swing/attack inconsistencies, automated target selection, rotation snapping/smoothing/perfect tracking.

NoFall: Full server-side fall-distance model using Y position, grounded state, velocity, expected damage, block collisions, water, slime, powder snow, vines, ladders, scaffolding, beds, hay, vehicles, effects, etc. Require multiple pieces of evidence.

ESP / Storage ESP / Player ESP: Behavioral only (container targeting, pathing, line-of-sight history, hidden-container discovery patterns, buried chest navigation, impossible interactions). Never claim the server can detect client-side ESP rendering.

X-Ray: Statistical + behavioral (ore discovery rate, ore-to-stone ratio, mining patterns, direction changes, hidden-ore targeting, time-to-valuable-blocks). Configurable, seed-independent, luck-tolerant.

Inventory: InventoryMove, ChestMove, invalid/impossible actions, Fast inventory, AutoArmor, AutoTotem, ChestStealer, duplication attempts, packet anomalies. Respect legitimate high-speed inventory management and shift-clicking.

Scaffold / Bridging: Scaffold, Tower, Eagle, SafeWalk, BridgeAssist, invalid placement angles/timing/rotations, automatic bridging patterns.

Packets: Malformed movement, invalid order/frequency, bursts, impossible timing, duplicates, invalid interaction sequences, flooding, timer manipulation, transaction anomalies. Distinguish lag/ping/loss from actual manipulation. Never punish late packets caused by network issues alone.

Multi-action / Automation: Suspicious simultaneous automated sequences and machine-like patterns only (never assume concurrent actions = cheating).

Rotation: Full analysis of yaw/pitch deltas, acceleration, deceleration, frequency, target-relative behavior, snapping, smoothing, randomness, reaction time, impossible angular values. Detect both blatant and subtle assistance without simplistic “delta == X” rules.

### Systems to Implement
- ViolationLevel engine (configurable thresholds + decay)
- Evidence system (rolling buffer, /aegis evidence )
- Punishment system (alert, verbose, cancel, setback, freeze, kick, temp/perm ban) – all configurable
- Commands: /aegis alerts|verbose|check|evidence|info|reload|debug|violations|punish
- Permissions: aegis.alerts, aegis.verbose, aegis.admin, aegis.bypass
- Internal statistical behavior engine (movement/rotation/click/combat/mining consistency, confidence 0.0–1.0)
- False-positive protection (ping, TPS, teleport, respawn, dimension, vehicles, knockback, explosions, pistons, blocks, effects, creative/spectator, other plugins, minigames)
- Other plugins can register exemptions
- Performance: async where safe, no main-thread DB, minimal allocations, object pooling, efficient player data, cleanup on disconnect, configurable analysis frequency. Target 100+ players with negligible TPS impact.
- Database: SQLite default, optional MySQL/MariaDB (async)
- Optional Admin INVENTORY GUI
- Detailed config.yml + messages config for every check and threshold
- VersionAdapter, PacketAdapter, MovementEngine, CombatEngine, ViolationEngine, EvidenceEngine, PunishmentEngine, CheckManager, PlayerDataManager, CompatibilityManager

### Development Rules
- Clean, modular, production-quality Java (interfaces, DI where appropriate, proper concurrency, JavaDoc)
- No fake implementations – every advertised feature must be real or clearly marked as a limitation
- Do not rely on client brand, mod list, or easily spoofable client info
- Assume sophisticated/private clients that randomize everything
- Detection must be based on server-verifiable behavior and physics
- Never claim the system can detect every future/private cheat or is impossible to bypass

### Deliverables
Complete project: pom.xml (or Gradle), plugin.yml, full Java source, config.yml, messages, database layer, version + packet adapters, all checks, command/permission systems, evidence + punishment systems, test suite, README with installation + configuration docs.

Before writing code: design the architecture and briefly explain how each major detection system works while respecting the non-punishable rules above.

Prioritize: server-authoritative detection, extremely low false positives, performance, modularity, and resistance to sophisticated clients.
Kodari AI
KodariAug 15 at 6:38 pm 4
AegisAC
A server-authoritative anti-cheat plugin for Paper 1.21.x with a modular multi-layered detection engine. Implements movement physics analysis, combat behavior verification, rotation pattern detection, packet anomaly monitoring, and statistical behavior profiling. Features a violation-level system with decay, evidence recording, configurable punishments, and comprehensive false-positive safeguards. Includes version adapters, async database storage, admin GUI, and full command/permission system. Prioritizes extremely low false positives by requiring multiple independent signals before flagging, never punishing legitimate techniques like high CPS or cosmetic mods.

Architecture:

  1. Core lifecycle wires a version adapter, packet abstraction, player state, checks, violation decay, evidence, async persistence, punishments, and commands through dependency injection.

  2. Checks consume server-authoritative Bukkit/Paper events. Movement and combat checks validate physics, reach, line of sight, rotation bounds, fall damage, inventory movement, and impossible placement; statistical checks retain rolling behavior rather than trusting a single signal.

  3. Every punitive signal passes exemption, confidence, evidence, threshold, minimum-sample, and decay gates. CPS and cosmetic/client-mod observations remain telemetry-only unless independent server-invalid automation evidence is present.

  4. SQLite is the default asynchronous evidence store, with optional MySQL/MariaDB configuration. Version-sensitive code is isolated behind VersionAdapter; the packet abstraction uses stable events and can report when raw packet support is unavailable.

  5. The project includes configuration, messages, permissions, administrative commands, and documentation that explicitly separates implemented detections from server-side limitations.

  1. Created AegisAC’s modular Paper 1.21.x architecture with version and packet abstractions, player state, exemptions, checks, violation decay, evidence, punishment, commands, and async database persistence.

  2. Implemented server-authoritative checks for movement physics, invalid movement, no-fall, rotation bounds, reach, wall attacks, automated attack patterns, inventory movement, invalid placement, and X-ray behavioral telemetry.

  3. Added configurable thresholds, confidence gates, minimum samples, decay, permissions, messages, SQLite/MySQL settings, and disabled-by-default kick/ban actions.

  4. Added /aegis administration commands, README documentation, and a JUnit test suite covering core models and bounded telemetry.

  5. High CPS, drag/butterfly/jitter clicking, cosmetic modifications, resource packs, crosshair changes, and client-only ESP/X-ray rendering are not independently punishable.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
38 1,612
src/main/java/com/kodari/aegisac/AegisAC.java
package com.kodari.aegisac;

import com.kodari.aegisac.command.AegisCommand;
import com.kodari.aegisac.compat.CompatibilityManager;
import com.kodari.aegisac.data.PlayerDataManager;
import com.kodari.aegisac.evidence.DatabaseManager;
import com.kodari.aegisac.evidence.EvidenceEngine;
import com.kodari.aegisac.engine.CheckManager;
import com.kodari.aegisac.engine.PunishmentEngine;
import com.kodari.aegisac.engine.ViolationEngine;
import com.kodari.aegisac.packet.PacketAdapter;
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.util.Map;

public final class AegisAC extends JavaPlugin {
    private FileConfiguration messages;
    private PlayerDataManager playerDataManager;
    private DatabaseManager databaseManager;
    private EvidenceEngine evidenceEngine;
    private ViolationEngine violationEngine;
    private PunishmentEngine punishmentEngine;
    private CheckManager checkManager;
    private CompatibilityManager compatibilityManager;
    private PacketAdapter packetAdapter;
    private boolean debug;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);
        reloadMessages();
        debug = getConfig().getBoolean("analysis.debug", false);

        playerDataManager = new PlayerDataManager(this);
        databaseManager = new DatabaseManager(this);
        databaseManager.start();
        evidenceEngine = new EvidenceEngine(this, databaseManager);
        violationEngine = new ViolationEngine(this);
        punishmentEngine = new PunishmentEngine(this);
        checkManager = new CheckManager(this, playerDataManager, evidenceEngine, violationEngine, punishmentEngine);
        compatibilityManager = new CompatibilityManager(this);
        packetAdapter = compatibilityManager.createPacketAdapter(checkManager);
        packetAdapter.start();

        getServer().getPluginManager().registerEvents(checkManager, this);
        AegisCommand command = new AegisCommand(this);
        PluginCommand aegis = getCommand("aegis");
        if (aegis != null) {
            aegis.setExecutor(command);
            aegis.setTabCompleter(command);
        }
        getLogger().info("AegisAC enabled with " + compatibilityManager.getVersionAdapter().getServerVersion());
    }

    @Override
    public void onDisable() {
        if (packetAdapter != null) packetAdapter.stop();
        if (violationEngine != null) violationEngine.stop();
        if (databaseManager != null) databaseManager.close();
    }

    public void reloadMessages() {
        messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));
    }

    public String message(String path, Map<String, String> placeholders) {
        String result = messages.getString(path, path);
        for (Map.Entry<String, String> entry : placeholders.entrySet()) {
            result = result.replace("%" + entry.getKey() + "%", entry.getValue());
        }
        return ChatColor.translateAlternateColorCodes('&', result);
    }

    public String message(String path) {
        return message(path, Map.of());
    }

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
        getConfig().set("analysis.debug", debug);
        saveConfig();
    }

    public PlayerDataManager getPlayerDataManager() { return playerDataManager; }
    public EvidenceEngine getEvidenceEngine() { return evidenceEngine; }
    public ViolationEngine getViolationEngine() { return violationEngine; }
    public PunishmentEngine getPunishmentEngine() { return punishmentEngine; }
    public CheckManager getCheckManager() { return checkManager; }
    public CompatibilityManager getCompatibilityManager() { return compatibilityManager; }
}