N

"Create a professional, production-ready Minecraft Spigot/Paper anti-cheat plugin called UltraGuard V3 for Minecraft 1.20+. Use Java 17 and Paper API. Every cheat detection must be in its own separate class file extending abstract base class Check.java.

BASE SYSTEM:

Create abstract class Check.java with methods: onEnable(), onDisable(), check(Player player), getName(), getViolationThresholds(). Create PlayerData.java to store per-player data: violation counts HashMap, last position, last velocity, last attack time, CPS history list, last block placed, fall distance, sprint state, hunger level, totem slot, packet count, fishing timestamps, boat state, fire exposure time, rotation history, inventory click timestamps, etc. Create ViolationManager.java to handle all violation counting, decay (1 per 30 seconds clean gameplay), and punishments (10 violations = warn, 25 = kick, 50 = ban from config). Create AlertManager.java to send colored alerts to admins with permission 'ultraguard.alerts' showing player name, hack type, violations, location, ping.

FALSE POSITIVE PREVENTION (Apply to ALL checks):

Before any movement check verify server TPS above 15. Add 10 tick grace period after any teleport. Always check all active potion effects. Check player gamemode — never flag creative/spectator. Check player ping — above 300ms give 50% looser thresholds. Never flag whitelisted players. Pause all checks during server restart countdown.

PERFORMANCE REQUIREMENTS:

Use async tasks where possible. Cache all data in PlayerData object. Use primitive types not boxed types. Target under 0.5ms per player per tick. Minimize object creation in hot paths.

NOW IMPLEMENT ALL 70 DETECTIONS:

  1. KillAuraCheck.java:

Flag if player hits more than 3 different entities within 1 second. Flag if attack angle exceeds 90 degrees from facing direction using yaw/pitch vector math. Flag if player attacks while inventory is open. Flag if hit timing variance is less than 5ms for 10+ consecutive hits. Flag if player attacks through solid walls via raycast check.

  1. SpeedCheck.java:

Calculate horizontal distance every PlayerMoveEvent. Normal sprint max 0.28 blocks per tick. Flag if exceeds 0.35 for 5 consecutive ticks. Check speed potion, soul speed boots, ice blocks, slime blocks before flagging. Use 5 tick rolling average.

  1. FlyCheck.java:

If not creative/spectator, not using elytra, not on block, not in water/lava/cobweb, not on ladder/vine, Y position does not decrease for 20 consecutive ticks — flag Fly. Add 3 tick grace after jump peak.

  1. NoFallCheck.java:

Track fall distance via Y changes. On landing if fall exceeds 4 blocks and damage is 0 — check feather falling, water, slime, hay bale, bed nearby. If none found flag NoFall.

  1. AutoClickerCheck.java:

Track CPS using PlayerInteractEvent and PlayerAnimationEvent. Flag if CPS exceeds 18. Flag if click interval standard deviation is under 5ms for 20 clicks (bot pattern).

  1. ReachCheck.java:

On EntityDamageByEntityEvent calculate 3D distance from player eye to entity bounding box nearest point. Flag if exceeds 3.2 blocks. Add lag compensation based on ping up to 100ms.

  1. XRayCheck.java:

Monitor ore mining. If player mines 8+ diamonds in 5 minutes, analyze tunnel straightness via coordinate standard deviation. Flag if variance under 1.5 blocks in straight line to ores.

  1. NoKnockbackCheck.java:

Record expected knockback vector on hit. Check actual velocity 2 ticks later. Flag if velocity change is under 30% of expected for 5 consecutive hits. Exclude wall collision cases.

  1. ScaffoldCheck.java:

Flag if player places blocks under feet while moving faster than 0.2 blocks per tick. Flag if more than 6 blocks placed per second in line pattern. Check pitch angle — scaffold bots have forward pitch not downward.

  1. FastBreakCheck.java:

Calculate minimum break time from block hardness, tool material, efficiency enchant, haste effect. Flag if block breaks in under 85% of minimum expected time.

  1. WaterWalkCheck.java:

Check every tick if player stands on water surface. Flag if stays on water more than 3 ticks without Frost Walker boots, lily pad, or creative mode.

  1. BhopCheck.java:

Flag if player jumps more than 3 times in 2 seconds while maintaining speed above normal sprint. Check that horizontal speed drops during jump — legitimate jump loses speed, bhop maintains it.

  1. JesusCheck.java:

Flag if player moves horizontally on water surface without descending, without Frost Walker, without lily pad. Distinguish from WaterWalk by checking movement type and packet pattern.

  1. AntiAFKCheck.java:

Flag if player repeats exact same rotation pattern for 60+ seconds. Flag if chat messages are sent at perfectly timed exact intervals. Only notify admin, do not auto-ban.

  1. InvalidPitchCheck.java:

Flag immediately if pitch goes outside -90 to 90 degrees. Flag if pitch changes more than 90 degrees in single tick. High confidence — flag at 3 violations.

  1. PhaseCheck.java:

Every PlayerMoveEvent check if player is inside solid block. Flag if inside solid block for 2+ consecutive ticks. Add 5 tick grace after nearby piston activation.

  1. TimerCheck.java:

Monitor PlayerMoveEvent packets per second. Normal is 20 per second. Flag if consistently more than 22 packets per second for 3 seconds.

  1. VelocityCheck.java:

When server sends velocity to player, check actual velocity 3 ticks later. Flag if actual velocity is under 50% of sent velocity without wall collision or blocking.

  1. AimbotCheck.java:

Flag if yaw/pitch snaps more than 45 degrees in single tick while attacking. Analyze rotation smoothness — unnaturally perfect tracking = aimbot. Flag if player hits entity while looking more than 5 degrees away for 3+ hits (silent aimbot).

  1. FastEatCheck.java:

Normal eating takes 32 ticks. Track eating start time on PlayerInteractEvent with food. Flag if PlayerItemConsumeEvent fires in under 25 ticks consistently.

  1. NoSlowCheck.java:

Flag if player moves faster than 0.15 blocks per tick while eating, blocking with shield, or drawing bow. Check hand item and action state each tick.

  1. StrafeCheck.java:

Flag if player changes horizontal direction more than 30 degrees while airborne and maintains full speed. Account for server lag.

  1. InventoryMoveCheck.java:

Flag if player moves more than 0.1 blocks while inventory is open. Track inventory state per player in PlayerData.

  1. FastLadderCheck.java:

Normal ladder climb is 0.11 blocks per tick. Flag if ascending faster than 0.15 blocks per tick on ladder/vine for 5 consecutive ticks. Check jump boost potion first.

  1. AntiPotionCheck.java:

On EntityPotionEffectEvent for negative effects thrown by another player, check if effect actually applies. Flag if effect is cancelled without milk bucket use.

  1. ChestStealerCheck.java:

Flag if player clicks more than 20 inventory slots within 1 second inside chest. Flag if player shift-clicks every item in chest in under 0.5 seconds.

  1. AutoArmorCheck.java:

Flag if player equips full 4-piece armor set in under 200ms. Flag if armor equipped without inventory being open.

  1. BlinkCheck.java:

Track movement packet timestamps. Flag if player stops sending packets for 2+ seconds then sends burst of 10+ movement packets instantly.

  1. NukerCheck.java:

Flag if player breaks more than 5 blocks per second. Flag if blocks broken in sphere pattern around player. Flag if breaking blocks not in line of sight.

  1. SpeedMineCheck.java:

Build break time database per player across 20 different block types. Flag if average break time is consistently 40% faster than maximum possible with best tools, enchants, and haste 2.

  1. AntiFireDamageCheck.java:

Monitor EntityDamageEvent with FIRE and FIRE_TICK cause. If player in fire/lava receives 0 damage without fire resistance potion or fire protection armor — flag. Flag if standing in fire 3+ seconds with no damage.

  1. AutoFishCheck.java:

Track time between bobber splash and player reel. Flag if reels in under 50ms of splash consistently for 5 catches. Flag if catch timing variance is under 10ms across 10 catches (impossible for humans).

  1. AutoSprintCheck.java:

Flag if player maintains sprint while changing direction more than 90 degrees, while taking damage, while eating food. Track sprint state vs direction changes over 10 second windows.

  1. BadPacketsCheck.java:

Flag invalid block interactions more than 6 blocks away. Flag placing blocks in invalid locations. Flag opening containers more than 6 blocks away. Flag duplicate packets in same tick.

  1. BoatFlyCheck.java:

Monitor players in boats. Flag if boat is airborne more than 5 ticks and moving horizontally. Check boat Y vs nearest solid block or water surface. Account for legitimate boat momentum launches.

  1. CaveFinderCheck.java:

Monitor digging patterns for precise turns leading directly to caves/ores. Analyze air-to-stone ratio in mined blocks. Flag if ratio is unnaturally high indicating cave finder ESP.

  1. CriticalHitCheck.java:

Critical hits only valid when player Y velocity is negative (falling). Monitor EntityDamageByEntityEvent for critical damage. Flag if critical hit registered while player is on ground, in water, on ladder, or sprinting without jump.

  1. EntitySpeedCheck.java:

Monitor players riding horses, pigs, striders, other entities. Calculate entity movement speed each tick. Flag if entity moves faster than its maximum possible speed (horse max ~0.34 blocks per tick). Check speed potion effect on rider before flagging.

  1. FastBowCheck.java:

Normal bow requires 20 ticks to fully charge. Track bow draw start time on PlayerInteractEvent with bow. Flag if arrow fires in under 15 ticks with full damage. Check Quick Charge crossbow separately.

  1. FastSneakCheck.java:

Monitor PlayerToggleSneakEvent frequency. Flag if player toggles sneak more than 10 times per second. Normal human cannot toggle sneak that fast. Also flag if sneak toggles at perfectly consistent intervals under 50ms (macro detection).

  1. FreecamCheck.java:

Freecam allows player camera to move while body stays still. Detect by monitoring player position vs look direction. Flag if player sends look packets but no movement packets for 5+ seconds while not AFK (inventory not open, no container open). Cross-reference with packet rate.

  1. HighJumpCheck.java:

Calculate maximum possible jump height based on jump boost potion level. Normal jump max is 1.25 blocks, Jump Boost 1 = 1.9 blocks, Jump Boost 2 = 2.5 blocks. Flag if player exceeds maximum expected jump height by more than 0.3 blocks.

  1. IceSpeedCheck.java:

Ice and blue ice give speed boost. Calculate maximum legitimate speed on ice (0.98 blocks per tick on blue ice with speed 2). Flag if player exceeds this threshold on ice blocks. Track block type under player each tick.

  1. InfiniteAuraCheck.java:

Different from KillAura — detect attacks on entities beyond any reasonable range (more than 6 blocks). Flag immediately for single occurrence. Also flag if player attacks entities in all directions simultaneously within 0.5 seconds (360 degree aura). High confidence detection, low violation threshold of 5.

  1. LongJumpCheck.java:

Monitor horizontal distance covered during single jump arc. Normal jump covers max 3.5 blocks horizontally. Flag if player covers more than 4.5 blocks horizontally in single jump without speed potion. Track jump start position and landing position.

  1. MobESPCheck.java:

Detect players targeting mobs through solid walls. Monitor player attack direction vs mob locations. Flag if player consistently attacks in exact direction of mobs hidden behind walls before any line of sight is possible. Analyze attack vector patterns over 30 second windows.

  1. MultiAuraCheck.java:

Different from KillAura — detect simultaneous damage to multiple entities in single tick. Flag if player damages more than 2 entities in exact same game tick (impossible in vanilla without AOE weapons). Exclude explosions, fire spread, and AOE potion effects.

  1. NoClipCheck.java:

Enhanced version of PhaseCheck. Detect player moving through blocks while maintaining velocity. Flag if player enters solid block and exits other side without being pushed out by block collision. Track entry and exit points of solid blocks.

  1. NoFireEffectCheck.java:

Detect players canceling fire screen overlay without removing fire damage. Monitor if player is on fire (EntityDamageEvent FIRE cause received) but fire overlay packets are being cancelled. Flag if player takes fire damage but fire visual effect is not present based on entity fire ticks.

  1. NoHurtCamCheck.java:

When player takes damage, camera shake packet is sent. Detect if player is modifying or canceling this packet. Monitor EntityDamageEvent and check if player velocity includes hurt knockback component. Flag if damage received but zero hurt knockback applied without shield or resistance.

  1. NoJumpDelayCheck.java:

After landing from jump there is minimum 10 tick delay before next jump. Monitor jump timestamps. Flag if player jumps again within 6 ticks of landing. Track landing tick and next jump tick per player.

  1. NoWebCheck.java:

Cobweb reduces movement speed to near zero. Monitor player speed while inside cobweb block. Normal max speed in cobweb is 0.03 blocks per tick. Flag if player moves faster than 0.05 blocks per tick while inside cobweb block. Check block type at player position each tick.

  1. PanicCheck.java:

Panic mode = player suddenly stops all hack behavior when admin joins or types command. Detect sudden complete normalization of previously flagged behavior. If player had 20+ violations in last minute and all unusual patterns suddenly stop exactly when admin joins server — log as Panic detection. Only logs, does not punish automatically, notifies admin.

  1. ParkourCheck.java:

Detect automated parkour hacking. Monitor jump timing at edges of blocks. Flag if player consistently jumps at exact last possible pixel of blocks (within 0.01 block of edge) for 10+ consecutive jumps. Normal humans have much higher variance in jump timing. Calculate edge proximity at each jump event.

  1. PlayerESPCheck.java:

Detect players tracking others through walls. Monitor attack and movement patterns relative to hidden players. Flag if player consistently moves toward and attacks players through solid walls before line of sight exists. Analyze directional correlation between player movement and hidden player locations.

  1. RegenCheck.java:

Monitor health regeneration rate. Normal regen with full hunger is 1 heart per 4 seconds. With Regeneration 1 potion is 1 heart per 2.5 seconds. Regeneration 2 is 1 heart per 1.2 seconds. Flag if health increases faster than maximum possible regeneration rate accounting for all potion effects and beacon effects. Sample health every 20 ticks.

  1. SafewalkCheck.java:

Safewalk prevents falling off edges automatically. Detect by monitoring movement near block edges. Flag if player consistently stops moving at exactly the edge of blocks (within 0.05 blocks) without visibly slowing down beforehand for 10+ consecutive edge encounters. Normal players occasionally fall or at least slow down.

  1. SneakCheck.java:

Always-sneak hack keeps player permanently sneaking. Monitor PlayerToggleSneakEvent. Flag if player remains in sneak state for more than 10 continuous minutes without ever standing up. Also flag if sneak state does not change despite player running at full sprint speed (impossible in vanilla — sneaking prevents sprinting).

  1. SpeedFlyCheck.java:

Combination of fly and speed hacks. Detect players moving horizontally at speed while also being airborne beyond normal jump height. Flag if player is more than 2 blocks above ground AND moving horizontally faster than 0.4 blocks per tick simultaneously. This combination is impossible in vanilla survival.

  1. StepCheck.java:

Normal step height is 0.6 blocks (one step up). Step hack allows walking up full blocks (1.0) or more without jumping. Monitor Y position changes during horizontal movement. Flag if player moves up more than 0.7 blocks in single tick without jump event being fired. Check for jump boost before flagging.

  1. StompCheck.java:

Stomp hack deals AOE damage when landing from height. Detect by monitoring EntityDamageByEntityEvent after player landing event. Flag if player deals damage to multiple entities within 2 blocks simultaneously upon landing. Vanilla landing has no AOE damage. Exclude TNT explosions and environmental effects.

  1. SuperKnockbackCheck.java:

Monitor knockback dealt by player to entities. Calculate expected knockback from weapon knockback enchantment and sprint state. Flag if victim entity receives more than 150% of expected knockback velocity from player attack. Check for knockback enchantment level on weapon before flagging.

  1. TriggerBotCheck.java:

TriggerBot auto-attacks when crosshair is on entity. Detect by analyzing attack timing relative to look direction changes. Flag if player attack fires within 1 tick of crosshair landing on entity for 10+ consecutive hits with under 10ms variance. Normal human reaction time is minimum 150ms — any consistent sub-50ms reaction is TriggerBot.

  1. AntiHungerCheck.java:

Monitor hunger level changes. Hunger should decrease with movement and actions. Track hunger level every 100 ticks. Flag if player is running, jumping, and fighting for 5+ minutes without any hunger decrease. Check if player has saturation effect or is in peaceful mode before flagging.

  1. AutoTotemCheck.java:

Monitor offhand slot changes. Flag if totem of undying appears in offhand within 100ms of player near-death event (health dropping below 1 heart). Normal human reaction minimum 200ms. Also flag if totem switches while player inventory is closed — impossible in vanilla.

  1. MassTPACheck.java:

Detect TPA request flooding. Monitor /tpa command usage. Flag if player sends more than 5 TPA requests within 10 seconds to different players. This indicates spam bot or harassment behavior. Mute TPA ability for flagged player for 5 minutes. Notify admin.

  1. PacketFlyCheck.java:

Different from regular FlyCheck — detect packet manipulation fly where player sends ground packets while actually flying. Monitor if player sends isOnGround=true in packets while Y position indicates they are airborne. Flag if ground state in packets does not match actual Y position calculation for 10+ consecutive packets.

  1. SkinBlinkCheck.java:

Detect skin/entity blink hacks where player rapidly changes entity data. Monitor entity metadata update frequency for player entities. Flag if player entity metadata updates more than 5 times per second. Normal client sends metadata updates rarely. High frequency updates indicate blink or ghost hack.

  1. ZoomHackCheck.java:

Detect zoom hacks that modify FOV without Optifine legitimately. Monitor if player attacks or interacts with entities at extreme distances while FOV would need to be modified. Flag if player consistently targets entities at ranges between 15-30 blocks with precision that requires zoom. Cross reference with Reach check data.

  1. GlitchSpeedCheck.java:

Detect speed gained through game mechanic glitches like boat glitching, bubble column abuse, or piston pushing exploits. Monitor speed in context of nearby special blocks. Flag if speed exceeds 0.5 blocks per tick near these mechanics without legitimate cause. Log all glitch speed incidents for admin review.

COMPLETE ADMIN COMMAND SYSTEM — UGCommand.java: /ug status — show all 70 violation counters color coded /ug reset — reset all violations /ug reset — reset specific hack /ug ban — manual ban /ug unban — unban /ug alerts — toggle receiving alerts /ug log — show last 20 flags /ug log all — show last 50 flags all players /ug whitelist add/remove — whitelist management /ug tps — show server TPS /ug reload — reload config live /ug top — most flagged players leaderboard /ug stats — total flags today, bans today, active violations /ug check — manually run specific check on player /ug freeze — f

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code