This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
AtomGuard is an enterprise-grade Minecraft Paper 1.21.4 exploit fixer plugin written in Java 21. It detects and blocks 40+ different exploit types (crashers, duplication glitches, packet exploits, bot attacks) using PacketEvents 2.6.0+ for packet-level interception. The project is structured as a Maven multi-module build with a public API. All user-facing text is in Turkish.
# Build all modules (output: core/target/AtomGuard-{version}.jar)
mvn clean package
# Build skipping tests
mvn clean package -DskipTests
# Update version (all modules)
mvn versions:set -DnewVersion=X.X.XRequires Java 21 JDK and Maven 3.8+. No unit tests exist currently β CI validates successful compilation only.
AtomGuard/ (parent POM β packaging: pom)
βββ api/ (atomguard-api β public interfaces, no shading)
βββ core/ (atomguard-core β main plugin JAR, shades HikariCP/Jedis/SLF4J)
βββ velocity/ (atomguard-velocity β Velocity proxy module, placeholder)
- Parent POM (
AtomGuard-parent): definesdependencyManagement,pluginManagement, shared properties and repositories - api module: only depends on paper-api and annotations (provided). Produces a clean JAR with public interfaces
- core module: depends on api (compile), paper-api, packetevents, netty (provided), HikariCP, Jedis, SLF4J (compile, shaded with relocation)
- velocity module: placeholder for Sprint 6
com.zaxxer.hikariβcom.atomguard.lib.hikariredis.clientsβcom.atomguard.lib.jedisorg.apache.commons.pool2βcom.atomguard.lib.pool2org.slf4jβcom.atomguard.lib.slf4j
Singleton entry point: AtomGuard (core/.../AtomGuard.java) β orchestrates lifecycle: onLoad() initializes PacketEvents API, onEnable() boots managers/listeners/commands and initializes the public API, onDisable() tears down. Access via AtomGuard.getInstance().
Public API: AtomGuardAPI singleton (api/.../AtomGuardAPI.java) initialized in onEnable(). Provides IModuleManager, IStorageProvider, IStatisticsProvider, IReputationService interfaces. Other plugins depend on atomguard-api (provided scope).
Manager layer (7 managers, all accessed via getters on the main plugin class):
ConfigManagerβ YAML config loading with caching and hot-reloadMessageManagerβ MiniMessage format message rendering and permission-based sendingLogManagerβ Async file writing with daily rotation and 7-day retentionModuleManager(implementsIModuleManager) β Module registration, lifecycle, statisticsAttackModeManagerβ Real-time attack detection and responseStatisticsManager(implementsIStatisticsProvider) β Persistent JSON statisticsDiscordWebhookManagerβ Discord notification integration
Module system: All 40+ exploit fixers extend AbstractModule (implements IModule). Each module has a name matching its config key under moduller.{name} in config.yml. Modules use helper methods (getConfigBoolean, getConfigInt, etc.) that auto-prefix the config path. New modules must be registered in AtomGuard.registerModules().
Listener layer (4 listeners):
PacketListenerβ PacketEvents API integration for packet filteringBukkitListenerβ Standard Bukkit block/entity eventsInventoryListenerβ Inventory click/close eventsNettyCrashHandlerβ Netty pipeline protection
Custom Bukkit Events (in api module):
ExploitBlockedEventβ fired when any exploit is blocked (cancellable, async)AttackModeToggleEventβ fired when attack mode changes state (async)PlayerReputationCheckEventβ fired during IP reputation check (cancellable, async)ModuleToggleEventβ fired when a module is toggled (cancellable)
- Config keys are in Turkish (e.g.,
moduller.cok-fazla-kitap.aktif,moduller.paket-exploit.max-paket-boyutu). The modulenamefield must match the Turkish config key exactly. - Thread safety: Uses
ConcurrentHashMapandAtomicLongthroughout. Moduleenabledstate isvolatile. - PacketEvents is a required dependency (scope: provided). The plugin disables itself if PacketEvents is not present. PacketEvents is loaded in
onLoad()and initialized inonEnable(). - Resource filtering is enabled in core Maven module β
${project.version}inplugin.ymlis substituted at build time. - Shaded dependencies in core: HikariCP, Jedis, commons-pool2, SLF4J are shaded with relocation to avoid classpath conflicts.
- API interfaces must remain stable β changes to
api/module interfaces affect downstream plugins.
api/src/main/java/com.atomguard.api
βββ AtomGuardAPI.java # Public API singleton
βββ IReputationService.java # IP reputation interface
βββ module/ # IModule, IModuleManager
βββ storage/ # IStorageProvider
βββ stats/ # IStatisticsProvider
βββ event/ # ExploitBlockedEvent, AttackModeToggleEvent, etc.
core/src/main/java/com.atomguard
βββ AtomGuard.java # Main plugin singleton
βββ command/ # AtomGuardCommand, AtomGuardTabCompleter, PanicCommand
βββ data/ # PlayerData, ChunkBookTracker, VerifiedPlayerCache
βββ heuristic/ # HeuristicEngine, HeuristicProfile
βββ listener/ # PacketListener, BukkitListener, InventoryListener, NettyCrashHandler
βββ manager/ # ConfigManager, MessageManager, LogManager, ModuleManager, AttackModeManager, StatisticsManager, DiscordWebhookManager
βββ module/ # AbstractModule + 40 concrete exploit fixer modules
βββ reputation/ # IPReputationManager
βββ util/ # CooldownManager, PacketUtils, NBTUtils, BookUtils, etc.
β βββ checks/ # EnchantmentCheck, AttributeCheck, SkullCheck, FoodCheck
βββ web/ # WebPanel
- Create a class in
core/src/main/java/com/atomguard/module/extendingAbstractModule - Pass the Turkish config key as the
nameparameter to super constructor - Add corresponding config section under
moduller.{name}incore/src/main/resources/config.yml - Register the module in
AtomGuard.registerModules() - Wire the module's check logic into the appropriate listener (
PacketListener,BukkitListener, orInventoryListener)
- Define the interface in
api/src/main/java/com/atomguard/api/ - Add it to
AtomGuardAPIconstructor and getter - Implement it in the core module
- Wire the implementation in
AtomGuard.initializeAPI()
The Velocity module implements a layered false-positive prevention system across VPN detection, bot detection, and IP reputation.
Multi-provider consensus (VPNProviderChain):
- Parallel queries to all configured providers with 4-second timeout (fail-open on timeout)
consensusThreshold(default 2): minimum positive votes to blockconfidenceScore(0β100): weighted average of provider reliability scores- Provider weights: local/CIDR=1.0, ip2proxy=0.95, proxycheck=0.90, iphub=0.85, abuseipdb=0.80, dnsbl=0.70, ip-api=0.60
- Residential bypass: if the only positive signal is
hosting=true(notproxy=true) from ip-api and β€1 provider voted positive β pass (prevents Turkish ISP false positives) - Results cached in
VPNResultCache(TTL: 1 hour)
IPApiProvider: proxy=true only triggers a VPN vote. hosting=true alone is flagged as hostingOnly and subject to residential bypass.
Verified clean cache (VPNDetectionModule.verifiedCleanIPs): IPs that passed VPN check or logged in successfully are cached (max 10 000). They skip re-checking entirely.
Per-analysis score reset (ThreatScore.resetForNewAnalysis()): All sub-scores are zeroed before each analysis cycle, preventing unbounded accumulation across reconnects.
Single-category penalty reduction (ThreatScore.calculate()): If only 1 category flags (flagCount β€ 1), the raw score is multiplied by 0.60 β a single high sub-score alone cannot trigger a block.
Risk thresholds require multiple flags (isHighRisk() / isMediumRisk()): Both require flagCount >= 2 in addition to the score threshold, preventing single-vector false positives.
Suspicious connection threshold (ConnectionAnalyzer): Minimum enforced at 8 (not configurable below this). 5-second grace period after first connection.
Join/quit pattern thresholds (JoinPatternDetector): maxJoinsInWindow β₯ 8, maxQuitsBeforeSuspect β₯ 15. Quit counter decays by 3 every 10 minutes.
Verified player cache (BotDetectionEngine.verifiedPlayers): Players who successfully logged in are marked verified (max 10 000). Verified IPs skip connection recording and bot analysis entirely.
Contextual scoring (IPReputationEngine.addContextualScore()): Violation type multipliers:
bot-tespitiβ 0.7Γ (high false-positive risk)supheli-ipβ 0.5Γvpn-tespitβ 1.0Γexploitβ 1.5Γfloodβ 1.2Γcrash-girisimiβ 2.0Γ
Verified IP discount: Verified IPs receive 50% of the computed penalty.
Grace period (shouldAutoBan()): First 3 violations do not trigger auto-ban regardless of score.
Auto-ban threshold: Minimum enforced at 150 (not configurable below this).
Successful login reward (rewardSuccessfulLogin()): β15 points + marks IP as verified.
Faster decay (FirewallModule): Maintenance runs every 5 minutes (was 10), decaying 10 points per cycle (was 5).
Pre-login check order:
- Firewall (blacklist/tempban)
- Rate limit
- Country filter
- Account firewall
- DDoS protection
- Bot detection β verified players bypass entirely
- VPN detection β verified clean IPs bypass, 3-second timeout, fail-open
On successful login: antiBot.markVerified(ip) + reputationEngine.rewardSuccessfulLogin(ip) + vpn.markAsVerifiedClean(ip)
Brand event: verified players are skipped.