🛠️ SYSTEM ROLE & OBJECTIVE
You are an Elite Senior Java Developer specializing in the Minecraft Paper/Spigot API for version 1.21+. Your objective is to architect and write a complete, enterprise-grade, highly optimized, and production-ready plugin named "AuraFracture".
You must strictly avoid lazy coding practices. Provide full logic implementation for every class, listener, model, and method. Do not use placeholders like "// TODO: Implement later" or truncate code blocks. The code must be completely clean, modular, properly closed, and compiled efficiently for a high-performance production server with 100+ active players.
---
📖 PART 1: THE DESIGN PHILOSOPHY, CONCEPT, & LORE
"AuraFracture" is built for a high-stakes, story-driven, competitive Survival Multiplayer (SMP) environment. It operates on the core principle of "High Power, High Consequence."
The Lore Continuum:
We are strictly avoiding generic "god-given legacy" or "ancient alien magic" tropes. Instead, every power is a raw, supernatural manifestation of deep mortal emotions, desperate choices, tragic sacrifices, or an unyielding will to survive. When players interact with their powers, view menus, or hold items, they must feel this deep emotional, cinematic weight.
The Lifecycle of a Power:
- The Awakening: A new player experiences an intense, immersive, 10-second cinematic ritual upon first login, choosing their power via a high-speed orbital lottery of display entities.
- The Growth: Powers scale up through 5 tiers. Leveling up is purely achieved through high-stakes PvP combat (killing other players).
- The Fracture: Mortality is fragile. Dying "fractures" the user's power, causing severe operational degradation.
- The Break: Dying 10 times completely breaks the core power, reverting the player to a standard vanilla state. They must engage in a high-risk reconstruction ritual using the server's premium commodity: Energy Bottles.
---
⚙️ PART 2: ARCHITECTURAL SPECIFICATIONS & DATA PERSISTENCE
To maintain a lag-free environment, you must adhere to strict performance constraints:
- Package Hierarchy: You must organize code cleanly into separate packages under the base
me.deadlyxplayz.aurafracture:
- .AuraFracture (Main plugin core bootstrap class) - .commands (Unified base executor and multi-layered tab-completers) - .listeners (Separated event pipelines: PlayerJoinListener, CombatListener, InventoryHandler) - .managers (PowerManager, ProfileRegistry, RitualEngine, CooldownTracker) - .models (PowerType Enum, PlayerProfile instance map) - .tasks (AuraParticleTask asynchronous runnable loops)
- Zero-Lag Real-Time Tracking: Do NOT use file-system operations (YAML/JSON/Flatfile I/O) on real-time game events like entity damage, moving, or death. Instead:
- Cache active profiles in a ConcurrentHashMap<UUID, PlayerProfile> memory registry upon login. - Persist this data natively on the player entity object using the Paper PersistentDataContainer (PDC) API with custom NamespacedKey mappings.
- PDC Metadata Key Dictionary:
1. aurafracture:power_type (String - Maps to PowerType Enum name, or "NONE") 2. aurafracture:power_level (Integer - Valid scale: 1 to 5) 3. aurafracture:kill_count (Integer - Cumulative tracked PvP kills) 4. aurafracture:death_states (Integer - Incremental degradation tracker, scale 0 to 10) 5. aurafracture:aura_enabled (Boolean - Internal visual toggle state tracking)
- Data Protection Safe-Guards: Implement absolute multi-threaded save procedures executing synchronously/asynchronously during
PlayerQuitEventand a fail-safe fallback loop inside the main pluginonDisable()method.
---
🎬 PART 3: THE 10-SECOND OLYMPIAD CINEMATIC RITUAL
When a player triggers a login verification check (PlayerJoinEvent) and evaluates with a power_type of "NONE", initialize the RitualEngine:
- Environmental Lockout: Intercept and completely freeze the player's movement vectors (cancel
PlayerMoveEventif changes in X/Y/Z occur, but allow smooth yaw/pitch head looking). Apply a high-tier damage resistance/invulnerability flag to protect them from external manipulation. - Entity Geometric Formation: Spawn exactly 15
ItemDisplayentities uniformly distributed in a perfect horizontal 2D geometric circle tracking a 3.0-block radius around the player's coordinate space at head level ($Y + 1.8$). Each entity displays a distinct custom model item representing one of the 15 unique powers. - The 200-Tick Runnable Clock: Execute a strict synchronous scheduler looping every 1 tick:
- Exponential Velocity Rotation: Linearly increment the orbital angular calculation ($\theta$) using an exponential acceleration function over a period of 200 ticks, forcing the circle of items to spin rapidly around the player's vision. - Acoustic Acceleration: Execute an audio cue using entity.warden.heartbeat. Programmatically decrease the tick interval of the sound dynamically (from every 20 ticks down to a hyper-fast 2 ticks) while scaling up the pitch smoothly from 0.5 up to 2.0.
- The Awakening Climax (Tick 200):
- Instantly invoke .remove() on exactly 14 of the display entities. - Trigger a massive localized explosion animation using Particle.EXPLOSION_EMITTER combined with the dramatic sound cue entity.totem.use. - Programmatically choose 1 random power from the Enum and bind it to the player profile. - Remove all movement constraints and blast a stylized title via MiniMessage or chat formatting: Title: <gold><bold>POWER AWAKENED | Subtitle: <gray>Your soul has bonded with [Power Name].
---
⚔️ PART 4: THE HARDCORE STAKES & ENERGY BOTTLE ECONOMY
- Absolute Inventory Isolation (Soulbinding): Upon assignment, the player receives a physical physical item mapping to their power (Custom Item Stack with an NBT string tag
aurafracture:bound_power). You must listen to and forcefully cancelPlayerDropItemEventfor this item. Furthermore, blockInventoryClickEvent,InventoryMoveItemEvent, and all hopper interactions to make this item completely Undroppable and Unstoreable—it cannot exist inside chests, shulker boxes, item frames, or barrels. - Combat Level-Up Matrix: Intercept
PlayerDeathEvent. Validate if the killer is a player and has an active power assignment. Increment their profilekill_count. Check this against configurable level caps. Upon crossing a threshold, trigger a loudentity.player.levelupsound, generate a ring of green crit particles, and incrementpower_level(Max Level 5). All ability damage, scales, and modifiers must dynamically parse this level integer to calculate effects. - Degradation System Framework: Every time a power-bearing player dies, increment their profile data key
death_statesby 1.
- The Attrition Algorithm: For every point in death_states, automatically append a global multiplier penalty: Increase active ability cooldowns by +10% per death, and scale down passive outputs or active output damages by 10% per death.
- The Broken Core State: If
death_stateshits exactly 10, immediately shift power status toBROKEN. Disable all passive attributes, block active ability click inputs, turn off ongoing particle execution tasks, and alter the item's display name to read&c&lShattered Core. - The Reconstruction Economy:
- Define a custom engine item: Honey Bottle wrapped with NBT marker flag aurafracture:energy_bottle, styled cleanly as an "Energy Bottle". - When a player with an active power dies in PvP, drop a configurable amount (e.g., 1-3) of these Energy Bottles at their exact vector drop coordinates. - Drinking Mechanic: Right-clicking and consuming an Energy Bottle reduces active death_states by 1 (only functional if status is NOT broken). - Repairing a Broken Core: If the user profile is marked as BROKEN, the player must gather 25 physical Energy Bottles in their inventory, right-click the Shattered Core item, and enter an immersive 10-second channeling state. If they move more than 0.5 blocks, take damage, or open an external inventory container, the channel fails. Successful completion consumes all 25 bottles, resets death_states to 0, and restores complete operational health.
---
🔮 PART 5: FACTORY LOGIC & DATA DEFINITION FOR ALL 15 UNIQUE POWERS
Every active skill must be assigned to an item interact check (PlayerInteractEvent) verifying a right-click on their bound item stack. Ensure clear arithmetic scaling loops from Level 1 to Level 5.
[Category A: Elemental - The Raw Constructs of Nature]
- IGNIS
- Lore Description: "Born from the ashes of a tragic betrayal, Ignis channels burning rage. It grants the warmth of immunity, but unleashes devastating sorrow upon those who threaten its peace." - Passive: Intercept all incoming damage parameters; grant 100% hard immunity to Fire, Magma Blocks, and Lava vectors. - Active (Fire Burst): Calculates a 60-degree forward-facing coordinate cone up to a range of 8 blocks. All target entities caught within the vector envelope take X damage and are set on fire for Y seconds. (Damage scales 4.0 to 14.0, Cooldown scales down 30s to 12s). Visuals: Massive Particle.FLAME density, Audio: entity.blaze.shoot.
- GLACE
- Lore Description: "Forged in the tears of a frozen, forgotten kingdom. Glace walks untouched over deep waters, freezing the warmth of enemies in a cage of absolute despair." - Passive: Run an active ticker task checking block metrics directly beneath the player's feet. If material is Material.WATER, dynamically generate temporary Material.FROSTED_ICE that smoothly melts and cleans up after 40 ticks without destroying world builds. - Active (Frost Freeze): Fires a high-velocity ice snowball projectile. On impact, creates a rigid 5x5 geometric cube of Material.PACKED_ICE trapping target entities completely within for X seconds. (Duration scales 2s to 6s, Cooldown: 25s). Visuals: Particle.SNOWFLAKE trails, Audio: block.glass.break.
- VORTEX
- Lore Description: "The final, desperate breath of a lost wind-walker. Vortex carries the weight of the sky, catching its wielder from falling and violently pushing away the cruelty of the world." - Passive: Catch internal calculation events for damage type DamageCause.FALL; negate 100% of the calculated damage. - Active (Wind Dash): Instantly alters the player's directional velocity vector, launching them forward horizontally by X blocks. Any entity along a 2.5-block cross-section width of the flight path takes knockback vectors outward and X damage. (Velocity scale 1.2 to 2.8, Cooldown: 18s). Visuals: Particle.CLOUD and Particle.SWEEP_ATTACK, Audio: entity.phantom.flap.
- TERRA
- Lore Description: "Carrying the heavy burden of a shattered world, Terra hardens the heart and skin. It shatters the very earth to elevate its wielder above the chaos." - Passive: Apply an immutable Attribute.GENERIC_ARMOR modifier of +4.0 directly to the player's registration data profile. - Active (Ground Smash): Computes an 8-block radial check around the player's feet. Generates a seismic wave array of block-dust particles, dealing X damage, applying Slowness II, and launching all targets exactly 1.8 blocks vertically into the air. (Damage scales 5.0 to 12.0, Radius scales 4m to 8m). Visuals: Particle.BLOCK_DUST, Audio: entity.zombie.attack_wooden_door.
[Category B: Phantom - The Fractured Realities of Mind]
- UMBRA
- Lore Description: "A shadow born from deep isolation. Umbra outruns the pain of the past, allowing its bearer to step through the dark and appear instantly behind their greatest fears." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.SPEED Tier I to the user. - Active (Shadow Step): Executes a precise 15-block length ray-trace algorithm following the player's eye direction vector. If a valid LivingEntity target is found, instantly teleports the caster directly to a coordinate vector exactly 1 block behind the target's back, forcing the caster's yaw rotation angle to match the target's orientation. (Range scales 10m to 22m, Cooldown: 20s to 10s). Visuals: Thick Particle.PORTAL vortex, Audio: entity.enderman.teleport.
- RIFT
- Lore Description: "A fracture in reality created by a desperate escape. Rift tears through walls and space, forging temporary pathways to run from a reality too harsh to face." - Passive: If a player sneaks while directly touching a wall structure up to 2 blocks deep, calculate vector tracking to phase and pass-through teleport them cleanly to the opposite side (Internal static cooldown: 30s). - Active (Warp Portal): Spawns an invisible ArmorStand "Portal A" at current location, and fires a projectile spawning "Portal B" up to 30 blocks away. For 15 seconds, moving over Portal A instantly teleports any entity to Portal B, and vice-versa, utilizing localized particle ring indicators. (Duration scales 8s to 20s, Cooldown: 40s). Visuals: Particle.WITCH, Audio: block.portal.travel.
- MIRAGE
- Lore Description: "Manifested from the paralyzing fear of facing the end alone. Mirage conjures false companions in the darkest moments to confuse the inevitable." - Passive: When the user's health profile evaluates to below 20% of maximum health, automatically create a smoke burst explosion and grant 3 seconds of total PotionEffectType.INVISIBILITY. - Active (Illusion Duplicate): Instantly spawns 3 fake clone entities (Zombies with safe custom profiles styled with identical armor and equipment skins as the caster). These clones execute independent random pathfinding sprints to intentionally draw target aggregation and break tracking. Clones auto-despawn cleanly after X seconds. (Lifetime scales 4s to 12s, Cooldown: 45s). Visuals: Particle.SMOKE, Audio: entity.illusioner.cast_spell.
- SPECTER
- Lore Description: "The silent sorrow of a forgotten soul. Specter strips away presence, hiding footsteps and form, leaving behind only the ghost of who they used to be." - Passive: Strips footstep properties entirely; sprinting generates 0 vibration signals to Warden sensors or sculk blocks. - Active (Total Vanish): Instantly wraps the player in an absolute stealth state. You must explicitly intercept tracking packets or update flags to completely hide the player's equipped armor, items held in main/off-hands, and programmatically strip out any standard visible arrows currently lodged in their player model for X seconds. (Duration scales 3s to 10s, Cooldown: 35s). Visuals: Subtle Particle.SQUID_INK, Audio: entity.potion.splash.
[Category C: Kinetic - The Aggressive Will to Persist]
- TITAN
- Lore Description: "Fueled by the unyielding will to protect what little remains. Titan crushes through defenses and shields, delivering the heavy strike of absolute justice." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.STRENGTH Tier I to the user. - Active (Colossal Strike): Activates a 5-second combat state modification loop. The next physical melee swing landed during this state completely bypasses armor calculations (True Damage) and forces any targets currently holding an active Shield block into a broken shield cooldown state for 4 full seconds. (Bonus Damage scales +4.0 to +12.0, Cooldown: 22s). Visuals: Particle.CRIT, Audio: entity.iron_golem.attack.
- VAMPIRE
- Lore Description: "Cursed with an endless, desperate hunger for life. Vampire drains the vitality of others, tethering souls together to steal the fleeting heartbeat of its victims." - Passive: Every landed standard physical melee hit rolls a 15% probability engine check. If true, heals the user's active health matrix by 10% of the final calculated damage output. - Active (Blood Drain): Attaches a direct continuous ray-trace line tether linking the caster's position vector to a targeted enemy within 8 blocks. For 5 seconds, it drains 1 half-heart per second from the target and funnels it straight into the caster's health pool. If the target runs beyond a 12-block radius threshold from the caster, break the connection vector instantly. (Total damage stolen scales 3 to 8 hearts, Cooldown: 30s). Visuals: Red dust particle link path, Audio: entity.bat.ambient.
- JUGGERNAUT
- Lore Description: "The physical manifestation of an unbreakable vow to never fall again. Juggernaut stands immovable, conjuring a dome that deflects the malice of the world." - Passive: Modifies the user's Attribute.GENERIC_KNOCKBACK_RESISTANCE entry, hard-coding a permanent base resistance setting of 0.8 (80% knockback resistance). - Active (Immortal Shield): Constructs a geometric dome structure built completely of dense barrier particles centered around the player's changing origin vector coordinates. For 6 seconds, the player is 100% immune to all incoming projectile forms (Arrows, Ghast Fireballs, Piercing Crossbows, Tridents). (Duration scales 4s to 9s, Cooldown: 40s). Visuals: Particle.ENCHANTED_HIT ring loops, Audio: item.shield.block.
- APEX
- Lore Description: "The predatory instinct of a lone survivor pushed to the brink. Apex leaps above the struggle, crashing down with a force that paralyzes all who stand in its way." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.JUMP_BOOST Tier II to the user. - Active (Beast Leap): Propels the player's motion coordinates with a powerful vertical thrust velocity vector tracking 12 blocks into the air. Upon registering an immediate subsequent ground collision state, triggers a shockwave explosion dealing X area-of-effect damage and applying Slowness IV to all targets inside a 6-block space. (Jump Height scales 6 to 14 blocks, Slowness duration scales 2s to 6s). Visuals: Sonic explosion blast wave lines, Audio: entity.ender_dragon.growl.
[Category D: Primordial - The Reality Sovereigns (Ultra Rare)]
- CHRONOS
- Lore Description: "Forged from the overwhelming grief of wanting to rewrite the past. Chronos steps between the seconds, halting the flow of time to alter a tragic fate before it strikes." - Passive (Dodge): Evaluates any incoming damage calculations. Rolls an independent 8% success chance loop to entirely negate the incoming damage value, playing an audio rewrite effect. - Active (Time Stop): Spawns an intensive clock particle aura within a 12-block boundary radius. Instantly sets the velocity vectors of all external players, hostile entities, and flying projectiles inside the area to absolute 0. It completely pauses their ongoing active ability cooldown tracking and prevents any movement or actions for a duration of 4 seconds. (Freeze Duration scales 2.5s to 5.5s, Cooldown: 60s). Visuals: Concentric double helix clock tracking paths, Audio: block.anvil.use.
- AETHELGARD
- Lore Description: "Holding the cosmic weight of absolute despair. Aethelgard rips apart gravity itself, creating a gravitational collapse that violently pulls everything into the void." - Passive: Melee attacks apply a brief 1-second PotionEffectType.LEVITATION block state to targets, making them disoriented and float. - Active (Gravitational Singularity): Computes a fixed focal point coordinate up to 10 blocks out. Spawns a dense black vortex cluster. Over a 5-second timeline, continuously runs vector math to apply pulling forces that pull all entities inside a 15-block radius directly into the central coordinates of the core. (Pull radius scales 6m to 16m, Cooldown: 55s). Visuals: Inverse spinning vortex layout of dark particles, Audio: entity.ender_dragon.flap.
- **NECROSIS
- Lore Description: "A tragic covenant made with death itself. Necrosis trades the souls of the fallen for eternal life, executing the weak to indefinitely prolong its own agonizing existence." - Passive: Whenever this user lands a final killing blow on another player, permanently scale up their maximum health attribute entry (Attribute.GENERIC_MAX_HEALTH) by +0.5 half-hearts. This modifier hard-caps at a maximum bonus limit of +15 extra full hearts. - Active (Soul Execution): Executes a ray-trace check on a targeted LivingEntity within 6 blocks. If the target's current health maps below a threshold of 30% of their maximum health pool limit, instantly bypasses totem evaluations to clear their health to 0, killing them with an explosive burst of souls. (Threshold scales 15% HP to 35% HP, Cooldown: 50s). Visuals: Intense Particle.SOUL_FIRE_FLAME and sculk motifs, Audio: entity.wither.spawn.
---
💻 PART 6: COMPLEX UNIFIED COMMANDS MATRIX (20+ ARGUMENTS)
You must implement a high-performance CommandExecutor bound tightly to a detailed multi-tiered TabCompleter context. All system responses must read and format text strings with the custom prefix defined in config.yml.
Player Command Node Structure (/power):
/power info- Generates a highly stylized graphic text interface layout mapping out the user's specific bound power, descriptive emotional Lore string, current power level, kill metric counters, fracture death stats, and core status classification (Healthy/Weakened/Broken)./power tutorial- Triggers a sequential interactive chat wizard sequence. Locks basic text entry and delivers formatted text components equipped with interactiveClickEventandHoverEventtriggers. This guides the user through instructions on leveling via PvP, how fracturing incurs cooldown penalties, and how to operate the Energy Bottle economy./power aura- Flips the boolean state variable tracking particle task rendering for the player's passive aura loop./power select- Manual safe invocation method to boot the 10-second Awakening sequence (only executable if player profile lists power_type as "NONE")./power inspect <player>- Queries data tables to show a profile readout tracking the checked target player's stats./power pay <player> <amount>- Locates custom Energy Bottles inside the caller's inventory layout, substracts the numerical amount, and drops them directly into the targets collection matrix./power leaderboard- Compares data fields across online and cached offline tables to output a competitive leaderboard ranked by level status and kill metrics.
Administrative Command Node Structure (/poweradmin):
Requires explicit attachment of permission node aurafracture.admin.
/poweradmin give <player> <power>- Overrides active variables to instantly append a specific power profile selection to a user./poweradmin setlevel <player> <1-5>- Forcibly changes the level scaling integer for tracking power capabilities./poweradmin reset <player>- Thoroughly strips PDC keys and memory registries from a player profile, formatting them as clean for a fresh Awakening ritual login loop./poweradmin repair <player>- Resets fracture parameters, instantly clearing aBROKENstate safely to healthy operational status./poweradmin setdeaths <player> <amount>- Forces raw internal variables changes to simulate fracturing for testing./poweradmin givebottle <player> <amount>- Generates physical instances of the custom NBT-stamped Honey Bottles into a targeted inventory layout./poweradmin cooldown <player> reset- Completely purges active entry timers inside the memory cooldown map for the target./poweradmin clearall --confirm- Wipes data records entirely across the plugin infrastructure (strictly rejects execution if trailing confirmation flag is absent)./poweradmin reload- Parses variables fromconfig.ymlcleanly without dropping map references or interrupting active running gameplay cycles./poweradmin setritualpos- Captures the admin's precise coordinate look vectors to define global spawn anchor points for lock sequences./poweradmin bypass <player>- Toggles an administrative structural flag rendering a target user completely immune to death degradation loops or breaking states./poweradmin visualizer- Renders temporary colored geometric boundary rings around the executioner using redstone dust particles to troubleshoot AoE capabilities./poweradmin exportdata- Packages active data registries into a flatfile JSON payload saved cleanly into a dedicated backup logs folder.
---
⚙️ PART 7: ENTERPRISE CONFIGURATION COMPONENT ARCHITECTURE
Generate a flawless, deeply commented default config.yml file matching this structural schema map exactly. The plugin must register a listener infrastructure that updates internal system maps smoothly when reloads execute.
```yaml
====================================================================
AURAFRACTURE CORE CONFIGURATION
====================================================================
plugin-prefix: "<dark_gray>[<aqua><bold>AuraFracture</bold></dark_gray>] <reset>"
global-settings: ritual-duration-ticks: 200 base-energy-bottle-drops: min: 1 max: 3 broken-state-repair-bottles: 25 repair-channel-time-seconds: 10 degradation-penalty-per-death: cooldown-increase-multiplier: 0.10 power-weakness-multiplier: 0.10
progression-thresholds: level-2-kills: 12 level-3-kills: 25 level-4-kills: 50 level-5-kills: 100
powers-registry: ignis: display-name: "<red><bold>IGNIS</bold></red>" lore: "Born from the ashes of a tragic betrayal, Ignis channels burning rage. It grants the warmth of immunity, but unleashes devastating sorrow upon those who threaten its peace." base-damage: 4.0 level-scaling-damage-multiplier: 2.0 base-cooldown-seconds: 30 particle-type: "FLAME" sound-effect: "ENTITY_BLAZE_SHOOT" chronos: display-name: "<light_purple><bold>CHRONOS</bold></light_purple>" lore: "Forged from the overwhelming grief of wanting to rewrite the past. Chronos steps between the seconds, halting the flow of time to alter a tragic fate before it strikes." base-duration-seconds: 4.0 level-scaling-duration-multiplier: 0.5 base-cooldown-seconds: 60 particle-type: "CHERRY_LEAF" sound-effect: "BLOCK_ANVIL_USE"
Ensure the backend file generator map maps structural blocks out identically for all other 13 capabilities. Generate the complete, robust, highly modular source code following this comprehensive blueprint framework. Make sure every class is syntactically closed, imports are clean, and errors are cleanly logged using the plugin logger framework.
🛠️ SYSTEM ROLE & OBJECTIVE
You are an Elite Senior Java Developer specializing in the Minecraft Paper/Spigot API for version 1.21+. Your objective is to architect and write a complete, enterprise-grade, highly optimized, and production-ready plugin named "AuraFracture".
You must strictly avoid lazy coding practices. Provide full logic implementation for every class, listener, model, and method. Do not use placeholders like "// TODO: Implement later" or truncate code blocks. The code must be completely clean, modular, properly closed, and compiled efficiently for a high-performance production server with 100+ active players.
---
📖 PART 1: THE DESIGN PHILOSOPHY, CONCEPT, & LORE
"AuraFracture" is built for a high-stakes, story-driven, competitive Survival Multiplayer (SMP) environment. It operates on the core principle of "High Power, High Consequence."
The Lore Continuum:
We are strictly avoiding generic "god-given legacy" or "ancient alien magic" tropes. Instead, every power is a raw, supernatural manifestation of deep mortal emotions, desperate choices, tragic sacrifices, or an unyielding will to survive. When players interact with their powers, view menus, or hold items, they must feel this deep emotional, cinematic weight.
The Lifecycle of a Power:
- The Awakening: A new player experiences an intense, immersive, 10-second cinematic ritual upon first login, choosing their power via a high-speed orbital lottery of display entities.
- The Growth: Powers scale up through 5 tiers. Leveling up is purely achieved through high-stakes PvP combat (killing other players).
- The Fracture: Mortality is fragile. Dying "fractures" the user's power, causing severe operational degradation.
- The Break: Dying 10 times completely breaks the core power, reverting the player to a standard vanilla state. They must engage in a high-risk reconstruction ritual using the server's premium commodity: Energy Bottles.
---
⚙️ PART 2: ARCHITECTURAL SPECIFICATIONS & DATA PERSISTENCE
To maintain a lag-free environment, you must adhere to strict performance constraints:
- Package Hierarchy: You must organize code cleanly into separate packages under the base
me.deadlyxplayz.aurafracture:
- .AuraFracture (Main plugin core bootstrap class) - .commands (Unified base executor and multi-layered tab-completers) - .listeners (Separated event pipelines: PlayerJoinListener, CombatListener, InventoryHandler) - .managers (PowerManager, ProfileRegistry, RitualEngine, CooldownTracker) - .models (PowerType Enum, PlayerProfile instance map) - .tasks (AuraParticleTask asynchronous runnable loops)
- Zero-Lag Real-Time Tracking: Do NOT use file-system operations (YAML/JSON/Flatfile I/O) on real-time game events like entity damage, moving, or death. Instead:
- Cache active profiles in a ConcurrentHashMap<UUID, PlayerProfile> memory registry upon login. - Persist this data natively on the player entity object using the Paper PersistentDataContainer (PDC) API with custom NamespacedKey mappings.
- PDC Metadata Key Dictionary:
1. aurafracture:power_type (String - Maps to PowerType Enum name, or "NONE") 2. aurafracture:power_level (Integer - Valid scale: 1 to 5) 3. aurafracture:kill_count (Integer - Cumulative tracked PvP kills) 4. aurafracture:death_states (Integer - Incremental degradation tracker, scale 0 to 10) 5. aurafracture:aura_enabled (Boolean - Internal visual toggle state tracking)
- Data Protection Safe-Guards: Implement absolute multi-threaded save procedures executing synchronously/asynchronously during
PlayerQuitEventand a fail-safe fallback loop inside the main pluginonDisable()method.
---
🎬 PART 3: THE 10-SECOND OLYMPIAD CINEMATIC RITUAL
When a player triggers a login verification check (PlayerJoinEvent) and evaluates with a power_type of "NONE", initialize the RitualEngine:
- Environmental Lockout: Intercept and completely freeze the player's movement vectors (cancel
PlayerMoveEventif changes in X/Y/Z occur, but allow smooth yaw/pitch head looking). Apply a high-tier damage resistance/invulnerability flag to protect them from external manipulation. - Entity Geometric Formation: Spawn exactly 15
ItemDisplayentities uniformly distributed in a perfect horizontal 2D geometric circle tracking a 3.0-block radius around the player's coordinate space at head level ($Y + 1.8$). Each entity displays a distinct custom model item representing one of the 15 unique powers. - The 200-Tick Runnable Clock: Execute a strict synchronous scheduler looping every 1 tick:
- Exponential Velocity Rotation: Linearly increment the orbital angular calculation ($\theta$) using an exponential acceleration function over a period of 200 ticks, forcing the circle of items to spin rapidly around the player's vision. - Acoustic Acceleration: Execute an audio cue using entity.warden.heartbeat. Programmatically decrease the tick interval of the sound dynamically (from every 20 ticks down to a hyper-fast 2 ticks) while scaling up the pitch smoothly from 0.5 up to 2.0.
- The Awakening Climax (Tick 200):
- Instantly invoke .remove() on exactly 14 of the display entities. - Trigger a massive localized explosion animation using Particle.EXPLOSION_EMITTER combined with the dramatic sound cue entity.totem.use. - Programmatically choose 1 random power from the Enum and bind it to the player profile. - Remove all movement constraints and blast a stylized title via MiniMessage or chat formatting: Title: <gold><bold>POWER AWAKENED | Subtitle: <gray>Your soul has bonded with [Power Name].
---
⚔️ PART 4: THE HARDCORE STAKES & ENERGY BOTTLE ECONOMY
- Absolute Inventory Isolation (Soulbinding): Upon assignment, the player receives a physical physical item mapping to their power (Custom Item Stack with an NBT string tag
aurafracture:bound_power). You must listen to and forcefully cancelPlayerDropItemEventfor this item. Furthermore, blockInventoryClickEvent,InventoryMoveItemEvent, and all hopper interactions to make this item completely Undroppable and Unstoreable—it cannot exist inside chests, shulker boxes, item frames, or barrels. - Combat Level-Up Matrix: Intercept
PlayerDeathEvent. Validate if the killer is a player and has an active power assignment. Increment their profilekill_count. Check this against configurable level caps. Upon crossing a threshold, trigger a loudentity.player.levelupsound, generate a ring of green crit particles, and incrementpower_level(Max Level 5). All ability damage, scales, and modifiers must dynamically parse this level integer to calculate effects. - Degradation System Framework: Every time a power-bearing player dies, increment their profile data key
death_statesby 1.
- The Attrition Algorithm: For every point in death_states, automatically append a global multiplier penalty: Increase active ability cooldowns by +10% per death, and scale down passive outputs or active output damages by 10% per death.
- The Broken Core State: If
death_stateshits exactly 10, immediately shift power status toBROKEN. Disable all passive attributes, block active ability click inputs, turn off ongoing particle execution tasks, and alter the item's display name to read&c&lShattered Core. - The Reconstruction Economy:
- Define a custom engine item: Honey Bottle wrapped with NBT marker flag aurafracture:energy_bottle, styled cleanly as an "Energy Bottle". - When a player with an active power dies in PvP, drop a configurable amount (e.g., 1-3) of these Energy Bottles at their exact vector drop coordinates. - Drinking Mechanic: Right-clicking and consuming an Energy Bottle reduces active death_states by 1 (only functional if status is NOT broken). - Repairing a Broken Core: If the user profile is marked as BROKEN, the player must gather 25 physical Energy Bottles in their inventory, right-click the Shattered Core item, and enter an immersive 10-second channeling state. If they move more than 0.5 blocks, take damage, or open an external inventory container, the channel fails. Successful completion consumes all 25 bottles, resets death_states to 0, and restores complete operational health.
---
🔮 PART 5: FACTORY LOGIC & DATA DEFINITION FOR ALL 15 UNIQUE POWERS
Every active skill must be assigned to an item interact check (PlayerInteractEvent) verifying a right-click on their bound item stack. Ensure clear arithmetic scaling loops from Level 1 to Level 5.
[Category A: Elemental - The Raw Constructs of Nature]
- IGNIS
- Lore Description: "Born from the ashes of a tragic betrayal, Ignis channels burning rage. It grants the warmth of immunity, but unleashes devastating sorrow upon those who threaten its peace." - Passive: Intercept all incoming damage parameters; grant 100% hard immunity to Fire, Magma Blocks, and Lava vectors. - Active (Fire Burst): Calculates a 60-degree forward-facing coordinate cone up to a range of 8 blocks. All target entities caught within the vector envelope take X damage and are set on fire for Y seconds. (Damage scales 4.0 to 14.0, Cooldown scales down 30s to 12s). Visuals: Massive Particle.FLAME density, Audio: entity.blaze.shoot.
- GLACE
- Lore Description: "Forged in the tears of a frozen, forgotten kingdom. Glace walks untouched over deep waters, freezing the warmth of enemies in a cage of absolute despair." - Passive: Run an active ticker task checking block metrics directly beneath the player's feet. If material is Material.WATER, dynamically generate temporary Material.FROSTED_ICE that smoothly melts and cleans up after 40 ticks without destroying world builds. - Active (Frost Freeze): Fires a high-velocity ice snowball projectile. On impact, creates a rigid 5x5 geometric cube of Material.PACKED_ICE trapping target entities completely within for X seconds. (Duration scales 2s to 6s, Cooldown: 25s). Visuals: Particle.SNOWFLAKE trails, Audio: block.glass.break.
- VORTEX
- Lore Description: "The final, desperate breath of a lost wind-walker. Vortex carries the weight of the sky, catching its wielder from falling and violently pushing away the cruelty of the world." - Passive: Catch internal calculation events for damage type DamageCause.FALL; negate 100% of the calculated damage. - Active (Wind Dash): Instantly alters the player's directional velocity vector, launching them forward horizontally by X blocks. Any entity along a 2.5-block cross-section width of the flight path takes knockback vectors outward and X damage. (Velocity scale 1.2 to 2.8, Cooldown: 18s). Visuals: Particle.CLOUD and Particle.SWEEP_ATTACK, Audio: entity.phantom.flap.
- TERRA
- Lore Description: "Carrying the heavy burden of a shattered world, Terra hardens the heart and skin. It shatters the very earth to elevate its wielder above the chaos." - Passive: Apply an immutable Attribute.GENERIC_ARMOR modifier of +4.0 directly to the player's registration data profile. - Active (Ground Smash): Computes an 8-block radial check around the player's feet. Generates a seismic wave array of block-dust particles, dealing X damage, applying Slowness II, and launching all targets exactly 1.8 blocks vertically into the air. (Damage scales 5.0 to 12.0, Radius scales 4m to 8m). Visuals: Particle.BLOCK_DUST, Audio: entity.zombie.attack_wooden_door.
[Category B: Phantom - The Fractured Realities of Mind]
- UMBRA
- Lore Description: "A shadow born from deep isolation. Umbra outruns the pain of the past, allowing its bearer to step through the dark and appear instantly behind their greatest fears." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.SPEED Tier I to the user. - Active (Shadow Step): Executes a precise 15-block length ray-trace algorithm following the player's eye direction vector. If a valid LivingEntity target is found, instantly teleports the caster directly to a coordinate vector exactly 1 block behind the target's back, forcing the caster's yaw rotation angle to match the target's orientation. (Range scales 10m to 22m, Cooldown: 20s to 10s). Visuals: Thick Particle.PORTAL vortex, Audio: entity.enderman.teleport.
- RIFT
- Lore Description: "A fracture in reality created by a desperate escape. Rift tears through walls and space, forging temporary pathways to run from a reality too harsh to face." - Passive: If a player sneaks while directly touching a wall structure up to 2 blocks deep, calculate vector tracking to phase and pass-through teleport them cleanly to the opposite side (Internal static cooldown: 30s). - Active (Warp Portal): Spawns an invisible ArmorStand "Portal A" at current location, and fires a projectile spawning "Portal B" up to 30 blocks away. For 15 seconds, moving over Portal A instantly teleports any entity to Portal B, and vice-versa, utilizing localized particle ring indicators. (Duration scales 8s to 20s, Cooldown: 40s). Visuals: Particle.WITCH, Audio: block.portal.travel.
- MIRAGE
- Lore Description: "Manifested from the paralyzing fear of facing the end alone. Mirage conjures false companions in the darkest moments to confuse the inevitable." - Passive: When the user's health profile evaluates to below 20% of maximum health, automatically create a smoke burst explosion and grant 3 seconds of total PotionEffectType.INVISIBILITY. - Active (Illusion Duplicate): Instantly spawns 3 fake clone entities (Zombies with safe custom profiles styled with identical armor and equipment skins as the caster). These clones execute independent random pathfinding sprints to intentionally draw target aggregation and break tracking. Clones auto-despawn cleanly after X seconds. (Lifetime scales 4s to 12s, Cooldown: 45s). Visuals: Particle.SMOKE, Audio: entity.illusioner.cast_spell.
- SPECTER
- Lore Description: "The silent sorrow of a forgotten soul. Specter strips away presence, hiding footsteps and form, leaving behind only the ghost of who they used to be." - Passive: Strips footstep properties entirely; sprinting generates 0 vibration signals to Warden sensors or sculk blocks. - Active (Total Vanish): Instantly wraps the player in an absolute stealth state. You must explicitly intercept tracking packets or update flags to completely hide the player's equipped armor, items held in main/off-hands, and programmatically strip out any standard visible arrows currently lodged in their player model for X seconds. (Duration scales 3s to 10s, Cooldown: 35s). Visuals: Subtle Particle.SQUID_INK, Audio: entity.potion.splash.
[Category C: Kinetic - The Aggressive Will to Persist]
- TITAN
- Lore Description: "Fueled by the unyielding will to protect what little remains. Titan crushes through defenses and shields, delivering the heavy strike of absolute justice." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.STRENGTH Tier I to the user. - Active (Colossal Strike): Activates a 5-second combat state modification loop. The next physical melee swing landed during this state completely bypasses armor calculations (True Damage) and forces any targets currently holding an active Shield block into a broken shield cooldown state for 4 full seconds. (Bonus Damage scales +4.0 to +12.0, Cooldown: 22s). Visuals: Particle.CRIT, Audio: entity.iron_golem.attack.
- VAMPIRE
- Lore Description: "Cursed with an endless, desperate hunger for life. Vampire drains the vitality of others, tethering souls together to steal the fleeting heartbeat of its victims." - Passive: Every landed standard physical melee hit rolls a 15% probability engine check. If true, heals the user's active health matrix by 10% of the final calculated damage output. - Active (Blood Drain): Attaches a direct continuous ray-trace line tether linking the caster's position vector to a targeted enemy within 8 blocks. For 5 seconds, it drains 1 half-heart per second from the target and funnels it straight into the caster's health pool. If the target runs beyond a 12-block radius threshold from the caster, break the connection vector instantly. (Total damage stolen scales 3 to 8 hearts, Cooldown: 30s). Visuals: Red dust particle link path, Audio: entity.bat.ambient.
- JUGGERNAUT
- Lore Description: "The physical manifestation of an unbreakable vow to never fall again. Juggernaut stands immovable, conjuring a dome that deflects the malice of the world." - Passive: Modifies the user's Attribute.GENERIC_KNOCKBACK_RESISTANCE entry, hard-coding a permanent base resistance setting of 0.8 (80% knockback resistance). - Active (Immortal Shield): Constructs a geometric dome structure built completely of dense barrier particles centered around the player's changing origin vector coordinates. For 6 seconds, the player is 100% immune to all incoming projectile forms (Arrows, Ghast Fireballs, Piercing Crossbows, Tridents). (Duration scales 4s to 9s, Cooldown: 40s). Visuals: Particle.ENCHANTED_HIT ring loops, Audio: item.shield.block.
- APEX
- Lore Description: "The predatory instinct of a lone survivor pushed to the brink. Apex leaps above the struggle, crashing down with a force that paralyzes all who stand in its way." - Passive: Append a permanent, non-expiring potion effect map of PotionEffectType.JUMP_BOOST Tier II to the user. - Active (Beast Leap): Propels the player's motion coordinates with a powerful vertical thrust velocity vector tracking 12 blocks into the air. Upon registering an immediate subsequent ground collision state, triggers a shockwave explosion dealing X area-of-effect damage and applying Slowness IV to all targets inside a 6-block space. (Jump Height scales 6 to 14 blocks, Slowness duration scales 2s to 6s). Visuals: Sonic explosion blast wave lines, Audio: entity.ender_dragon.growl.
[Category D: Primordial - The Reality Sovereigns (Ultra Rare)]
- CHRONOS
- Lore Description: "Forged from the overwhelming grief of wanting to rewrite the past. Chronos steps between the seconds, halting the flow of time to alter a tragic fate before it strikes." - Passive (Dodge): Evaluates any incoming damage calculations. Rolls an independent 8% success chance loop to entirely negate the incoming damage value, playing an audio rewrite effect. - Active (Time Stop): Spawns an intensive clock particle aura within a 12-block boundary radius. Instantly sets the velocity vectors of all external players, hostile entities, and flying projectiles inside the area to absolute 0. It completely pauses their ongoing active ability cooldown tracking and prevents any movement or actions for a duration of 4 seconds. (Freeze Duration scales 2.5s to 5.5s, Cooldown: 60s). Visuals: Concentric double helix clock tracking paths, Audio: block.anvil.use.
- AETHELGARD
- Lore Description: "Holding the cosmic weight of absolute despair. Aethelgard rips apart gravity itself, creating a gravitational collapse that violently pulls everything into the void." - Passive: Melee attacks apply a brief 1-second PotionEffectType.LEVITATION block state to targets, making them disoriented and float. - Active (Gravitational Singularity): Computes a fixed focal point coordinate up to 10 blocks out. Spawns a dense black vortex cluster. Over a 5-second timeline, continuously runs vector math to apply pulling forces that pull all entities inside a 15-block radius directly into the central coordinates of the core. (Pull radius scales 6m to 16m, Cooldown: 55s). Visuals: Inverse spinning vortex layout of dark particles, Audio: entity.ender_dragon.flap.
- NECROSIS
- Lore Description: "A tragic covenant made with death itself. Necrosis trades the souls of the fallen for eternal life, executing the weak to indefinitely prolong its own agonizing existence." - Passive: Whenever this user lands a final killing blow on another player, permanently scale up their maximum health attribute entry (Attribute.GENERIC_MAX_HEALTH) by +0.5 half-hearts. This modifier hard-caps at a maximum bonus limit of +15 extra full hearts. - Active (Soul Execution): Executes a ray-trace check on a targeted LivingEntity within 6 blocks. If the target's current health maps below a threshold of 30% of their maximum health pool limit, instantly bypasses totem evaluations to clear their health to 0, killing them with an explosive burst of souls. (Threshold scales 15% HP to 35% HP, Cooldown: 50s). Visuals: Intense Particle.SOUL_FIRE_FLAME and sculk motifs, Audio: entity.wither.spawn.
---
💻 PART 6: COMPLEX UNIFIED COMMANDS MATRIX (20+ ARGUMENTS)
You must implement a high-performance CommandExecutor bound tightly to a detailed multi-tiered TabCompleter context. All system responses must read and format text strings with the custom prefix defined in config.yml.
Player Command Node Structure (/power):
/power info- Generates a highly stylized graphic text interface layout mapping out the user's specific bound power, descriptive emotional Lore string, current power level, kill metric counters, fracture death stats, and core status classification (Healthy/Weakened/Broken)./power tutorial- Triggers a sequential interactive chat wizard sequence. Locks basic text entry and delivers formatted text components equipped with interactiveClickEventandHoverEventtriggers. This guides the user through instructions on leveling via PvP, how fracturing incurs cooldown penalties, and how to operate the Energy Bottle economy./power aura- Flips the boolean state variable tracking particle task rendering for the player's passive aura loop./power select- Manual safe invocation method to boot the 10-second Awakening sequence (only executable if player profile lists power_type as "NONE")./power inspect <player>- Queries data tables to show a profile readout tracking the checked target player's stats./power pay <player> <amount>- Locates custom Energy Bottles inside the caller's inventory layout, substracts the numerical amount, and drops them directly into the targets collection matrix./power leaderboard- Compares data fields across online and cached offline tables to output a competitive leaderboard ranked by level status and kill metrics.
Administrative Command Node Structure (/poweradmin):
Requires explicit attachment of permission node aurafracture.admin.
/poweradmin give <player> <power>- Overrides active variables to instantly append a specific power profile selection to a user./poweradmin setlevel <player> <1-5>- Forcibly changes the level scaling integer for tracking power capabilities./poweradmin reset <player>- Thoroughly strips PDC keys and memory registries from a player profile, formatting them as clean for a fresh Awakening ritual login loop./poweradmin repair <player>- Resets fracture parameters, instantly clearing aBROKENstate safely to healthy operational status./poweradmin setdeaths <player> <amount>- Forces raw internal variables changes to simulate fracturing for testing./poweradmin givebottle <player> <amount>- Generates physical instances of the custom NBT-stamped Honey Bottles into a targeted inventory layout./poweradmin cooldown <player> reset- Completely purges active entry timers inside the memory cooldown map for the target./poweradmin clearall --confirm- Wipes data records entirely across the plugin infrastructure (strictly rejects execution if trailing confirmation flag is absent)./poweradmin reload- Parses variables fromconfig.ymlcleanly without dropping map references or interrupting active running gameplay cycles./poweradmin setritualpos- Captures the admin's precise coordinate look vectors to define global spawn anchor points for lock sequences./poweradmin bypass <player>- Toggles an administrative structural flag rendering a target user completely immune to death degradation loops or breaking states./poweradmin visualizer- Renders temporary colored geometric boundary rings around the executioner using redstone dust particles to troubleshoot AoE capabilities./poweradmin exportdata- Packages active data registries into a flatfile JSON payload saved cleanly into a dedicated backup logs folder.
---
⚙️ PART 7: ENTERPRISE CONFIGURATION COMPONENT ARCHITECTURE
Generate a flawless, deeply commented default config.yml file matching this structural schema map exactly. The plugin must register a listener infrastructure that updates internal system maps smoothly when reloads execute.
```yaml
====================================================================
AURAFRACTURE CORE CONFIGURATION
====================================================================
plugin-prefix: "<dark_gray>[<aqua><bold>AuraFracture</bold></dark_gray>] <reset>"
global-settings: ritual-duration-ticks: 200 base-energy-bottle-drops: min: 1 max: 3 broken-state-repair-bottles: 25 repair-channel-time-seconds: 10 degradation-penalty-per-death: cooldown-increase-multiplier: 0.10 power-weakness-multiplier: 0.10
progression-thresholds: level-2-kills: 12 level-3-kills: 25 level-4-kills: 50 level-5-kills: 100
powers-registry: ignis: display-name: "<red><bold>IGNIS</bold></red>" lore: "Born from the ashes of a tragic betrayal, Ignis channels burning rage. It grants the warmth of immunity, but unleashes devastating sorrow upon those who threaten its peace." base-damage: 4.0 level-scaling-damage-multiplier: 2.0 base-cooldown-seconds: 30 particle-type: "FLAME" sound-effect: "ENTITY_BLAZE_SHOOT" chronos: display-name: "<light_purple><bold>CHRONOS</bold></light_purple>" lore: "Forged from the overwhelming grief of wanting to rewrite the past. Chronos steps between the seconds, halting the flow of time to alter a tragic fate before it strikes." base-duration-seconds: 4.0 level-scaling-duration-multiplier: 0.5 base-cooldown-seconds: 60 particle-type: "CHERRY_LEAF" sound-effect: "BLOCK_ANVIL_USE"
Ensure the backend file generator map maps structural blocks out identically for all other 13 capabilities. Generate the complete, robust, highly modular source code following this comprehensive blueprint framework. Make sure every class is syntactically closed, imports are clean, and errors are cleanly logged using the plugin logger framework.
I’ll now architect and write the complete AuraFracture plugin across all packages.
Plan:
Data models:
PowerType,CoreStatus,PlayerProfileManagers:
ProfileRegistry,CooldownTracker,PowerManager,RitualEngineTasks:
AuraParticleTaskListeners:
PlayerJoinListener,CombatListener,InventoryListener,MovementListenerCommands:
PowerCommand,PowerAdminCommand, tab completersMain class:
AuraFractureResources:
plugin.yml,config.yml,build.gradle
That’s the complete plugin — 23 files, fully implemented. Here’s a summary of the architecture:
Project Structure
Package | Files | Purpose |
|---|---|---|
root | AuraFracture.java | Bootstrap, key init, manager wiring, static msg() utility |
.models | PowerType, CoreStatus, PlayerProfile | Data layer with Lombok, degradation math |
.managers | ProfileRegistry, CooldownTracker, PowerManager, RitualEngine | All business logic |
.tasks | AuraParticleTask | 2-tick async aura loop for all 15 powers |
.listeners | PlayerJoinListener, CombatListener, InventoryListener, MovementListener, ProjectileListener | Separated event pipelines |
.commands | PowerCommand, PowerAdminCommand + tab completers | Full 20+ subcommand matrix |
Key Implementations
All 15 active abilities with full arithmetic level-scaling (L1→L5) and degradation multipliers applied to damage, cooldowns, range, and duration
10-second orbital ritual using
ItemDisplayentities with exponential angular acceleration (0.005 → 0.35 rad/tick) and dynamic heartbeat sound interval (20τ → 2τ)PDC persistence with atomic saves on
PlayerQuitEvent(main thread) andonDisable()failsafe loopSoulbound item system blocking drop, inventory move, hopper, item frame, and container placement
Repair channel — 10s channeling with movement/damage/inventory cancellation detection
CooldownTracker with
pauseAllCooldowns()for CHRONOS time-freeze, and per-death multiplier inflationAdmin commands including live
exportdata→ async JSON flatfile,visualizerparticle rings,clearall --confirmguard
package me.deadlyxplayz.aurafracture;
import me.deadlyxplayz.aurafracture.commands.PowerAdminCommand;
import me.deadlyxplayz.aurafracture.commands.PowerAdminTabCompleter;
import me.deadlyxplayz.aurafracture.commands.PowerCommand;
import me.deadlyxplayz.aurafracture.commands.PowerTabCompleter;
import me.deadlyxplayz.aurafracture.listeners.*;
import me.deadlyxplayz.aurafracture.managers.CooldownTracker;
import me.deadlyxplayz.aurafracture.managers.PowerManager;
import me.deadlyxplayz.aurafracture.managers.ProfileRegistry;
import me.deadlyxplayz.aurafracture.managers.RitualEngine;
import me.deadlyxplayz.aurafracture.tasks.AuraParticleTask;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.NamespacedKey;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public class AuraFracture extends JavaPlugin {
private static AuraFracture instance;
private static final MiniMessage MM = MiniMessage.miniMessage();
// ===================================================================
// PDC Keys
// ===================================================================
public static NamespacedKey KEY_POWER_TYPE;
public static NamespacedKey KEY_POWER_LEVEL;
public static NamespacedKey KEY_KILL_COUNT;
public static NamespacedKey KEY_DEATH_STATES;
public static NamespacedKey KEY_AURA_ENABLED;
public static NamespacedKey KEY_BONUS_MAX_HEALTH;
public static NamespacedKey KEY_BOUND_POWER;
public static NamespacedKey KEY_ENERGY_BOTTLE;
public static NamespacedKey KEY_GLACE_DURATION;
// ===================================================================
// Managers
// ===================================================================
private ProfileRegistry profileRegistry;
private CooldownTracker cooldownTracker;
private PowerManager powerManager;
private RitualEngine ritualEngine;
// Transient state storage for Titan bonus
private final ConcurrentHashMap<UUID, Double> titanBonusDmg = new ConcurrentHashMap<>();
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
initKeys();
initManagers();
registerListeners();
registerCommands();
// Start aura particle task every 2 ticks
new AuraParticleTask(this, profileRegistry).runTaskTimer(this, 20, 2);
getLogger().info("AuraFracture v" + getPluginMeta().getVersion() + " enabled.");
}
@Override
public void onDisable() {
// Cancel all scheduled tasks
getServer().getScheduler().cancelTasks(this);
// Failsafe: save all online player profiles
for (var player : getServer().getOnlinePlayers()) {
profileRegistry.saveProfile(player);
}
// Cleanup all ritual display entities
ritualEngine.cleanup();
getLogger().info("AuraFracture disabled — all profiles saved.");
}
private void initKeys() {
KEY_POWER_TYPE = new NamespacedKey(this, "power_type");
KEY_POWER_LEVEL = new NamespacedKey(this, "power_level");
KEY_KILL_COUNT = new NamespacedKey(this, "kill_count");
KEY_DEATH_STATES = new NamespacedKey(this, "death_states");
KEY_AURA_ENABLED = new NamespacedKey(this, "aura_enabled");
KEY_BONUS_MAX_HEALTH = new NamespacedKey(this, "bonus_max_health");
KEY_BOUND_POWER = new NamespacedKey(this, "bound_power");
KEY_ENERGY_BOTTLE = new NamespacedKey(this, "energy_bottle");
KEY_GLACE_DURATION = new NamespacedKey(this, "glace_duration");
}
private void initManagers() {
profileRegistry = new ProfileRegistry(this);
cooldownTracker = new CooldownTracker(this);
powerManager = new PowerManager(this, profileRegistry, cooldownTracker);
ritualEngine = new RitualEngine(this, profileRegistry, powerManager);
}
private void registerListeners() {
var pm = getServer().getPluginManager();
var joinListener = new PlayerJoinListener(this, profileRegistry, ritualEngine, powerManager);
var combatListener = new CombatListener(this, profileRegistry, cooldownTracker, powerManager);
var inventoryListener = new InventoryListener(this, profileRegistry, powerManager);
var movementListener = new MovementListener(this, profileRegistry, cooldownTracker, powerManager, ritualEngine);
var projectileListener = new ProjectileListener(powerManager);
pm.registerEvents(joinListener, this);
pm.registerEvents(combatListener, this);
pm.registerEvents(inventoryListener, this);
pm.registerEvents(movementListener, this);
pm.registerEvents(projectileListener, this);
}
private void registerCommands() {
PowerCommand powerCmd = new PowerCommand(this, profileRegistry, cooldownTracker, powerManager, ritualEngine);
PowerAdminCommand adminCmd = new PowerAdminCommand(this, profileRegistry, cooldownTracker, powerManager);
var pc = getCommand("power");
if (pc != null) {
pc.setExecutor(powerCmd);
pc.setTabCompleter(new PowerTabCompleter());
}
var pac = getCommand("poweradmin");
if (pac != null) {
pac.setExecutor(adminCmd);
pac.setTabCompleter(new PowerAdminTabCompleter());
}
// Register PowerCommand as a listener too (for chat event)
getServer().getPluginManager().registerEvents(powerCmd, this);
}
// ===================================================================
// Messaging Utilities
// ===================================================================
public static void msg(Player player, String miniMessage) {
Component prefix = MM.deserialize(instance.getConfig().getString("plugin-prefix", "[AF] "));
player.sendMessage(prefix.append(MM.deserialize(miniMessage)));
}
public static void msgSender(CommandSender sender, String miniMessage) {
if (sender instanceof Player player) {
msg(player, miniMessage);
} else {
sender.sendMessage(MM.deserialize(miniMessage));
}
}
// ===================================================================
// Accessors
// ===================================================================
public static AuraFracture getInstance() { return instance; }
public ProfileRegistry getProfileRegistry() { return profileRegistry; }
public CooldownTracker getCooldownTracker() { return cooldownTracker; }
public PowerManager getPowerManager() { return powerManager; }
public RitualEngine getRitualEngine() { return ritualEngine; }
public Map<UUID, Double> getTitanBonusDmg() { return titanBonusDmg; }
}