๐
pasted-code-1792408278343.txt
txt
1359 lines
โถ
# MASTER IMPLEMENTATION PROMPT โ MINECRAFT SMP: 3 LEGENDARY SUPER WEAPONS
## ROLE AND OBJECTIVE
You are a senior Minecraft Paper plugin developer, Java engineer, and game-mechanics designer.
Your task is to design, implement, test, and package a **complete, working Minecraft Paper plugin project** named `LegendaryWeapons`, containing three custom legendary weapons:
1. **VOIDREAPER** โ Cosmic Sword
2. **GRAVEBREAKER** โ Hunter Mace
3. **STORMFANG** โ Thunder Trident
This is a real implementation task, not a tutorial or a code-generation demonstration.
**You must deliver a complete project that compiles successfully into a usable plugin JAR and package the full project into a ZIP file.**
Do not stop after providing a plan, pseudocode, isolated Java classes, or code snippets. Create all required source files, resources, configuration, build scripts, tests, and documentation. If you have access to a terminal, use it to build and verify the project.
Do not claim that a build or test passed unless you actually executed it and verified the result.
---
# 1. PLUGIN OVERVIEW
Create an advanced custom-weapons plugin for a Minecraft Survival Multiplayer server.
Target server: **Minecraft Java Edition 1.21.11 running Paper**.
The plugin must introduce three powerful, visually distinct weapons with unique abilities, combat mechanics, activation controls, cooldowns, sounds, particles, and custom item identities.
The intended gameplay is a competitive SMP where players can use legendary weapons in PvP and PvE combat without causing unintended server damage or allowing ability exploits.
## Core requirements
- Three unique weapons with the exact names and abilities specified below.
- Independent cooldowns for every ability.
- Configurable cooldown durations, damage, ranges, effect durations, and particle settings.
- Clear action-bar cooldown messages.
- Activation and failure sounds.
- Persistent weapon identification using `PersistentDataContainer`.
- Custom item names, lore, enchantments, and resource-pack model support.
- Operator-authorized weapon distribution.
- Safe entity targeting and damage handling.
- Proper cleanup of scheduled tasks and temporary effects.
- Configuration validation and useful console error messages.
- No required external plugin dependencies unless explicitly justified.
- Complete source code, build files, tests, installation guide, and ZIP package.
The plugin must work alongside other ordinary Paper plugins and avoid unnecessarily modifying vanilla game mechanics.
---
# 2. PLATFORM AND BUILD REQUIREMENTS
Use the following development environment:
- Minecraft: Java Edition 1.21.11.
- Server software: Paper 1.21.11.
- Java: JDK 21.
- Language: Java.
- Build system: Gradle with the Gradle Wrapper, or Maven if a complete reproducible build is provided.
- Paper API: A version compatible with Paper 1.21.11.
- Plugin metadata: `plugin.yml` using the appropriate API version for the target server.
- Main class: `com.soulrift.legendaryweapons.LegendaryWeaponsPlugin`.
- Plugin name: `LegendaryWeapons`.
- Initial plugin version: `1.0.0`.
Use the official Paper API and stable, supported Bukkit/Paper methods. Avoid NMS, reflection, hard-coded server internals, and deprecated methods unless there is a documented technical necessity.
Keep the plugin compatible with the specified version rather than claiming compatibility with every Minecraft release.
Official references:
- Paper API documentation: https://jd.papermc.io/paper/1.21.11/
- Paper project setup: https://docs.papermc.io/paper/dev/project-setup/
- Plugin metadata documentation: https://docs.papermc.io/paper/dev/plugin-yml/
Use the appropriate Java toolchain and Paper repository in the build configuration. The Paper API must be declared as a compile-time dependency, not bundled into the plugin JAR.
---
# 3. COMPLETE PROJECT STRUCTURE
Create a maintainable project resembling the following:
```text
LegendaryWeapons/
โโโ build.gradle.kts
โโโ settings.gradle.kts
โโโ gradlew
โโโ gradlew.bat
โโโ gradle/
โ โโโ wrapper/
โโโ README.md
โโโ LICENSE
โโโ .gitignore
โโโ docs/
โ โโโ INSTALLATION.md
โ โโโ COMMANDS.md
โ โโโ CONFIGURATION.md
โ โโโ WEAPONS.md
โ โโโ TESTING.md
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โ โ โโโ com/
โ โ โ โโโ soulrift/
โ โ โ โโโ legendaryweapons/
โ โ โ โโโ LegendaryWeaponsPlugin.java
โ โ โ โโโ command/
โ โ โ โ โโโ LegendaryWeaponsCommand.java
โ โ โ โ โโโ LegendaryWeaponsTabCompleter.java
โ โ โ โโโ weapon/
โ โ โ โ โโโ WeaponType.java
โ โ โ โ โโโ WeaponFactory.java
โ โ โ โ โโโ WeaponIdentifier.java
โ โ โ โโโ ability/
โ โ โ โ โโโ AbilityManager.java
โ โ โ โ โโโ AbilityType.java
โ โ โ โ โโโ CooldownManager.java
โ โ โ โ โโโ CosmicDrainAbility.java
โ โ โ โ โโโ CosmicSlashAbility.java
โ โ โ โ โโโ BlackHoleAbility.java
โ โ โ โ โโโ ExecutionAbility.java
โ โ โ โ โโโ GravityCrashAbility.java
โ โ โ โ โโโ MeteorDropAbility.java
โ โ โ โ โโโ ThunderSpearAbility.java
โ โ โ โ โโโ TempestAbility.java
โ โ โ โโโ listener/
โ โ โ โ โโโ WeaponInteractionListener.java
โ โ โ โ โโโ WeaponCombatListener.java
โ โ โ โ โโโ WeaponLifecycleListener.java
โ โ โ โ โโโ PlayerStateListener.java
โ โ โ โโโ effect/
โ โ โ โ โโโ ParticleEffects.java
โ โ โ โ โโโ SoundEffects.java
โ โ โ โ โโโ TemporaryEffectManager.java
โ โ โ โโโ service/
โ โ โ โ โโโ TargetingService.java
โ โ โ โ โโโ DamageService.java
โ โ โ โ โโโ SafeLocationService.java
โ โ โ โโโ util/
โ โ โ โโโ MessageUtil.java
โ โ โ โโโ CooldownFormatter.java
โ โ โโโ resources/
โ โ โโโ plugin.yml
โ โ โโโ config.yml
โ โโโ test/
โ โโโ java/
โ โโโ com/
โ โโโ soulrift/
โ โโโ legendaryweapons/
โ โโโ CooldownManagerTest.java
โ โโโ WeaponIdentifierTest.java
โ โโโ ConfigurationTest.java
โโโ build/
โ โโโ libs/
โ โโโ LegendaryWeapons-1.0.0.jar
โโโ LegendaryWeapons-Complete.zip
```
This structure is a guide, not permission to create empty placeholder files. Adjust it when necessary, but keep responsibilities separated and all implementations complete.
Every class referenced by the build must exist, compile, and contain its intended functionality. Do not leave `TODO` comments in place of required features.
---
# 4. WEAPON IDENTITY AND ITEM CREATION
Implement a centralized weapon factory that creates the three weapons.
Each weapon must have:
- A unique display name.
- Distinctive colored display text.
- Custom lore describing its abilities and controls.
- Appropriate base material.
- Optional configurable enchantments.
- Unbreakable status by default, configurable by administrators.
- Custom model data support.
- A persistent, namespaced weapon identifier.
- Optional custom attributes only when necessary.
Suggested default presentation:
| Weapon | Material | Theme |
|---|---|---|
| VOIDREAPER | NETHERITE_SWORD | Purple-black cosmic energy |
| GRAVEBREAKER | MACE | Dark iron and purple gravity |
| STORMFANG | TRIDENT | Electric blue lightning |
Use Adventure components where supported for item names and messages.
Store the weapon identity in the item's `PersistentDataContainer`, for example:
- `legendaryweapons:weapon_id`
- `legendaryweapons:weapon_version`
Use the weapon ID as the authoritative identifier. Never identify a weapon solely by its display name or lore.
The plugin must recognize legitimate weapons after a player reconnects, moves them between inventory slots, stores them in a chest, or restarts the server.
Renaming an item with an anvil must not turn an ordinary weapon into a legendary weapon or erase the identity of a genuine weapon.
The factory must create fresh, correctly identified items. Distribution commands must not accidentally duplicate weapons because of repeated event handling.
## Resource-pack support
Provide configurable custom model data for each weapon and document how to create a resource pack for its visual appearance.
Do not claim that custom textures are included if the actual texture files are not supplied. The plugin must still work correctly without a resource pack.
---
# 5. WEAPON ONE โ VOIDREAPER, THE COSMIC SWORD
Theme: cosmic energy, spatial distortion, purple-black particles, void explosions, and dark purple lightning.
Base item: Netherite Sword.
Display name: `VOIDREAPER`.
## 5.1 Passive โ Cosmic Drain
**Trigger:** The wielder successfully hits a living entity using VOIDREAPER.
**Behavior:**
1. Check that the attacker is a player holding a genuine VOIDREAPER.
2. Confirm that the attack is eligible for the passive.
3. Check the player's last successful Cosmic Drain activation.
4. If at least five seconds have elapsed, restore one heart, equivalent to 2 health points.
5. Never heal above the player's current maximum health.
6. Trigger a subtle purple particle effect and an appropriate sound when healing occurs.
**Cooldown:** 5 seconds per wielder.
The passive must have its own independent cooldown and must not share a cooldown with any active ability.
Prevent passive activation from repeatedly triggering through duplicate event callbacks, damage loops, or artificial damage generated by the plugin itself.
If the wielder is already at full health, do not generate a false successful-heal notification. Do not heal dead players.
Use the supported health-regeneration API and respect applicable healing restrictions.
## 5.2 Ability One โ Cosmic Slash
**Activation:** Sneak + right-click while holding VOIDREAPER.
**Cooldown:** 15 seconds.
**Range:** 12 blocks.
**Base damage:** 6 health points, equivalent to 3 hearts.
**Behavior:**
1. Detect a right-click interaction with the sword while the player is sneaking.
2. Cancel the interaction only when necessary to prevent conflicting ability behavior.
3. Check the independent Cosmic Slash cooldown.
4. Perform the configured activation sound.
5. Create a forward-moving purple cosmic slash.
6. Travel up to 12 blocks in the direction the player is looking.
7. Detect eligible entities along the slash path, not merely at the final destination.
8. Deal six points of damage to each eligible entity according to the configured multi-target policy.
9. Apply directional knockback.
10. Play impact sounds and particle effects on successful hits.
Use a controlled repeating task or equivalent scheduled progression for projectile-like movement. Do not teleport the player.
**Target rules:**
- Never damage the wielder.
- Ignore spectators.
- Respect the configured PvP rules.
- Ignore invalid or dead entities.
- Do not hit the same target multiple times during a single slash unless explicitly configured.
- Stop or safely terminate the slash when it reaches its range or an invalid location.
- Prevent the effect from passing through solid blocks unless wall penetration is explicitly enabled.
Default: wall penetration disabled.
## 5.3 Ability Two โ Black Hole
**Activation:** Right-click while holding VOIDREAPER and not sneaking.
**Cooldown:** 30 seconds.
**Maximum targeting distance:** 15 blocks.
**Duration:** 3 seconds.
**Damage:** 2 health points per second, equivalent to 1 heart per second.
**Behavior:**
1. Determine a valid target location using a block ray trace up to 15 blocks.
2. If no valid location is available, use the last valid ray-trace result only if it satisfies the configured targeting policy. Otherwise, cancel activation and provide feedback.
3. Spawn a miniature black-hole visual at the selected location.
4. Pull eligible nearby living entities toward its center for three seconds.
5. Apply damage at one-second intervals, with the first damage tick occurring according to the configured tick policy.
6. Generate purple-black particles, portal-like effects, and appropriate sounds.
7. End the effect automatically after the duration expires.
Add configurable settings for:
- Pull radius.
- Pull strength.
- Duration.
- Damage per tick.
- Damage interval.
- Maximum targets.
- Wall and line-of-sight restrictions.
The black hole must not pull the wielder by default.
Do not pull entities through solid walls. Avoid unsafe teleportation, excessive velocity, and movement that sends entities into the void or dangerous unloaded areas.
If the world unloads or the caster disconnects, clean up the effect safely.
## 5.4 Ultimate โ EXECUTION
**Activation:** Prefer a configurable command, `/legendary execute`, or a supported configurable item interaction while holding VOIDREAPER.
The default Minecraft F key swaps the player's offhand item, but a normal server-side Paper plugin cannot directly detect an arbitrary physical keypress independently of the resulting game interaction. Do not invent an F-key event or require a client-side mod.
You may use the offhand-swap event as an optional trigger, but only when it can be detected reliably and safely.
**Default cooldown:** 60 seconds.
**Target range:** 12 blocks.
**Mark duration:** 3 seconds.
**Damage:** 12 health points, equivalent to 6 hearts, before applicable armor and protection mitigation.
**Execution behavior:**
1. Verify that the player is holding VOIDREAPER.
2. Validate that the player is allowed to use the ultimate.
3. Find the nearest eligible living target in the player's forward view within 12 blocks.
4. Require appropriate line of sight.
5. If no valid target exists, cancel activation and display a clear message.
6. Mark the target with a distinctive purple-black cosmic effect.
7. Start a three-second execution window.
8. Show the target a configurable warning effect or message, where appropriate.
9. If the wielder successfully lands a qualifying direct melee hit on the marked target before expiration, consume the mark and trigger the execution effect.
10. Spawn purple lightning-like particles, dark particles, a short animation, and a cosmic explosion.
11. Deal 12 raw damage through the normal entity-damage system, allowing armor, protection, resistance, and other applicable damage modifiers to operate.
12. Remove the mark after successful execution.
13. If the three-second window expires without a qualifying hit, remove the mark without dealing execution damage.
14. Start the ultimate cooldown when the mark is successfully initiated. A configurable policy may refund the cooldown if the target disappears, but never permit repeated free execution attempts.
**Critical anti-exploit rules:**
- Execution must not bypass armor or protection.
- Execution must not directly set a target's health to zero.
- The ability must not guarantee an instant kill.
- Do not execute a different entity from the marked target.
- A hit on a different entity must not trigger execution.
- Do not permit a new execution mark while another is pending for the same player.
- Prevent duplicate activation caused by offhand-swap and interaction events firing close together.
- Cancel the mark if the target dies, disconnects, becomes invalid, changes world, or becomes ineligible.
- Cancel the mark if the wielder dies, disconnects, changes world, or loses the required weapon, according to the configurable cancellation policy.
- Store the mark's target UUID, owner UUID, expiration time, and state.
- Ensure all temporary tasks are cleaned up.
The visual effect may look devastating, but its actual damage must remain governed by the normal combat system.
---
# 6. WEAPON TWO โ GRAVEBREAKER, THE HUNTER MACE
Theme: dark iron, purple gravity, ground fractures, powerful shockwaves, and meteor impacts.
Base item: Mace.
Display name: `GRAVEBREAKER`.
## 6.1 Ability One โ Gravity Crash
**Activation:** Sneak + right-click while holding GRAVEBREAKER.
**Cooldown:** 20 seconds.
**Radius:** 6 blocks.
**Damage:** 6 health points, equivalent to 3 hearts.
**Behavior:**
1. Verify the item identity and activation input.
2. Check the Gravity Crash cooldown.
3. Play a heavy impact sound.
4. Create a radial shockwave centered on the wielder.
5. Spawn expanding purple shockwave particles.
6. Damage eligible entities within six blocks.
7. Apply upward knockback with a configurable horizontal component.
8. Produce a short ground-crack visual without permanently modifying terrain.
Use squared-distance checks where practical to reduce unnecessary calculations.
Exclude the wielder, spectators, dead entities, and invalid targets.
The default ability must not break blocks, create permanent craters, or destroy player builds.
If the player is in a region where PvP or ability damage is prohibited, obey the applicable protection policy.
## 6.2 Ability Two โ Meteor Drop
**Activation:** Right-click while holding GRAVEBREAKER and airborne.
**Cooldown:** 35 seconds.
**Maximum launch height:** Configurable.
**Maximum impact damage:** 10 health points, equivalent to 5 hearts.
**Behavior:**
1. Check that the player is airborne and not riding an entity.
2. Verify the ability cooldown.
3. Give the player a controlled upward launch.
4. Start the Meteor Drop state.
5. Apply a distinct falling or meteor visual while the player descends.
6. Detect the player's first valid landing after activation.
7. Create an impact effect at the landing location.
8. Calculate damage from distance to the impact point.
9. Deal up to 10 damage to eligible entities.
10. Apply configurable outward and upward knockback.
11. Clear the active Meteor Drop state and all associated tasks.
Use a configurable damage formula. The default should deal the maximum damage near the impact and decrease damage linearly to zero at the configured outer radius.
A recommended default impact radius is 6 blocks.
**Landing and failure handling:**
- Do not activate when the player is already grounded.
- Do not trigger repeatedly while the player is standing on the same block.
- Prevent activation while another Meteor Drop is active.
- Do not allow a second activation to overwrite an existing fall state.
- Handle water, ladders, scaffolding, elytra flight, teleportation, death, disconnection, world changes, and server shutdown safely.
- Do not create an impact explosion that destroys terrain.
- Ensure a failed or interrupted activation clears temporary state.
- Do not disable normal vanilla fall damage globally.
Define and document whether the ability's landing impact replaces the wielder's fall damage. Prefer protecting the wielder from the ability's own impact damage while retaining normal vanilla fall damage behavior unless the configuration explicitly says otherwise.
---
# 7. WEAPON THREE โ STORMFANG, THE THUNDER TRIDENT
Theme: electric blue lightning, thunder, storm particles, and chain attacks.
Base item: Trident.
Display name: `STORMFANG`.
## 7.1 Ability One โ Thunder Spear
**Activation:** Right-click while holding STORMFANG and not sneaking.
**Cooldown:** 15 seconds.
**Primary damage:** 6 health points, equivalent to 3 hearts.
**Maximum chain targets:** 3 additional enemies.
**Behavior:**
1. Detect right-click activation.
2. Verify that the player is holding a genuine STORMFANG.
3. Check the Thunder Spear cooldown.
4. Create a visible electric-blue projectile or simulated lightning spear.
5. Aim toward the player's selected target point within a configurable maximum range.
6. Move the projectile forward using a controlled scheduled task.
7. Detect the first eligible entity collision.
8. Deal six damage to the primary target.
9. Chain lightning to up to three additional eligible enemies near the primary impact point.
10. Create a separate visual effect for each chain jump.
11. Play appropriate electric and thunder sounds.
12. Clean up the projectile task when it hits a target, reaches maximum range, collides with an obstruction, or expires.
The default primary projectile range should be configurable and set to 20 blocks.
The chain radius should default to 4 blocks.
Each secondary chain target should receive configurable damage, defaulting to 3 health points. Secondary damage must not exceed primary damage by default.
The primary target must not be hit repeatedly by the chain effect.
Do not use real lightning strikes as the only damage mechanism because vanilla lightning can have unintended fire, environmental, and entity effects. Prefer visual lightning particles combined with controlled entity damage.
A real lightning entity may only be used as a visual effect when its environmental and damage behavior can be safely controlled. Otherwise, use particle-based lightning.
## 7.2 Ability Two โ Tempest
**Activation:** Sneak + right-click while holding STORMFANG.
**Cooldown:** 45 seconds.
**Duration:** 5 seconds.
**Effect:** Speed II for the wielder.
**Behavior:**
1. Check the Tempest cooldown.
2. Apply Speed II to the wielder for the configured duration.
3. Create a storm effect around the player.
4. Produce electric-blue particles and occasional thunder sounds.
5. Periodically damage eligible nearby enemies during the five-second duration.
6. Remove the effect after the duration expires.
Default enemy damage: 2 health points per second.
Default radius: 4 blocks.
The wielder must not be damaged by Tempest.
Use a configurable damage interval and apply damage only once per scheduled interval. Avoid applying damage every server tick.
Respect existing potion effects. Do not permanently erase a stronger Speed effect supplied by another plugin. Preserve and restore prior effect state when practical, or use a clearly documented safe effect-management policy.
Cancel temporary tasks on player death, disconnect, world change, or plugin shutdown.
---
# 8. ACTIVATION INPUTS AND EVENT PRIORITY
Implement an input handler that distinguishes normal Minecraft item behavior from weapon abilities.
## Input mapping
| Input | VOIDREAPER | GRAVEBREAKER | STORMFANG |
|---|---|---|---|
| Right-click, not sneaking | Black Hole | Meteor Drop, if airborne | Thunder Spear |
| Sneak + right-click | Cosmic Slash | Gravity Crash | Tempest |
| Execution command | EXECUTION | Not applicable | Not applicable |
The right-click behavior for GRAVEBREAKER must be airborne-only. If the wielder is grounded, show an appropriate message and do not consume the cooldown.
Do not activate an ability when the player is interacting with a protected container, unless the interaction is explicitly intended to activate the ability and the configuration permits it.
Use event cancellation selectively. Preserve normal behavior for unrelated items and ordinary players.
For the trident, ensure the plugin's ability input does not unexpectedly throw the item. For the mace, ensure custom abilities do not inadvertently interfere with ordinary weapon use. For the sword, preserve ordinary melee attacks and normal durability behavior according to configuration.
If an ability requires right-clicking and vanilla interaction conflicts with it, handle that conflict explicitly and document the resulting behavior.
Use the correct Paper/Bukkit interaction and combat events. Prevent duplicate activation when several related events are generated from the same input.
---
# 9. DAMAGE SYSTEM AND COMBAT SAFETY
Implement a shared `DamageService`.
All ability damage must use an appropriate supported entity-damage API with the attacking player or responsible entity supplied when possible.
Do not directly subtract health to simulate attack damage.
The system must:
- Preserve armor, enchantment protection, resistance, and applicable damage modifiers.
- Respect damage-cancellation events and compatible protection plugins where feasible.
- Prevent unintended damage to the ability caster.
- Respect configurable PvP restrictions.
- Ignore dead or invalid entities.
- Prevent repeated damage from a single collision or damage interval.
- Distinguish plugin-generated damage from vanilla weapon damage when necessary.
- Avoid recursive ability triggers caused by damage events.
- Keep the damage source identifiable for debugging.
- Avoid creating fake damage events through deprecated constructors.
If protection plugins cannot be detected or fully supported without a dependency, document the limitation and provide a configurable integration hook or optional integration.
## Friendly-fire and PvP rules
Provide configuration options for:
- Player-versus-player damage.
- Player-versus-mob damage.
- Same-team damage prevention where supported.
- Self-damage prevention.
- Ability damage in protected regions.
- Spectator targeting.
- Creative-mode targeting.
- Maximum targets per ability.
By default, do not allow an ability to damage its caster.
The plugin must not claim compatibility with every region-protection plugin without actual testing.
---
# 10. INDEPENDENT COOLDOWN SYSTEM
Implement a centralized, reliable `CooldownManager`.
Each ability must have its own independent cooldown key.
Suggested keys:
- `VOIDREAPER:COSMIC_DRAIN`
- `VOIDREAPER:COSMIC_SLASH`
- `VOIDREAPER:BLACK_HOLE`
- `VOIDREAPER:EXECUTION`
- `GRAVEBREAKER:GRAVITY_CRASH`
- `GRAVEBREAKER:METEOR_DROP`
- `STORMFANG:THUNDER_SPEAR`
- `STORMFANG:TEMPEST`
Store cooldowns by player UUID and ability ID.
Use timestamps based on a monotonic clock where possible. Do not rely on counting scheduled ticks as the sole source of cooldown time.
## Cooldown behavior
When an ability is activated:
1. Validate the weapon and activation.
2. Validate player state and target requirements.
3. Check the ability's cooldown.
4. If the cooldown is active, do not start the ability.
5. Display the remaining cooldown in seconds.
6. Play a failure sound.
7. If activation succeeds, set the cooldown according to the documented activation policy.
8. Display an activation message and play the activation sound.
Remaining cooldown must be calculated from elapsed time and rounded up to a readable number of seconds.
Examples:
- `Cosmic Slash ready in 8s`
- `Black Hole ready in 21s`
- `EXECUTION ready in 42s`
Use configurable messages.
The passive Cosmic Drain cooldown must not block the sword's other abilities.
A player activating Cosmic Slash must not reset the Black Hole cooldown.
Different players must never share cooldowns accidentally.
Do not store a separate cooldown for every individual item copy unless that behavior is explicitly added as an optional feature.
Cooldowns may reset when the server restarts by default, provided this is documented. If persistent cooldowns are implemented, store expiration timestamps safely and validate them when loading data.
## Action-bar requirements
Provide action-bar feedback for:
- Ability activation.
- Active cooldown rejection.
- Remaining cooldown time.
- Execution mark initiation.
- Execution success.
- Execution expiration.
- Invalid target.
- Invalid activation state.
Avoid excessive message spam. Repeated status updates should be throttled or use a configurable action-bar refresh interval.
Do not overwrite unrelated action-bar content more frequently than necessary.
---
# 11. PARTICLES, ANIMATIONS, AND SOUNDS
Implement centralized visual and audio utilities.
Use native particles and sounds available in Minecraft 1.21.11. Do not reference nonexistent enum values or assume that resource-pack assets are installed.
## VOIDREAPER
Suggested visuals:
- `PORTAL`
- `REVERSE_PORTAL`
- `DRAGON_BREATH`
- `WITCH`
- `DUST` with purple and black color variations.
- Carefully controlled lightning-like visual effects.
Suggested sounds:
- `ITEM_TRIDENT_RIPTIDE_1`
- `BLOCK_PORTAL_AMBIENT`
- `ENTITY_ENDERMAN_TELEPORT`
- `ENTITY_GENERIC_EXPLODE` at an appropriately reduced volume.
## GRAVEBREAKER
Suggested visuals:
- `BLOCK` particles using deepslate or blackstone.
- Purple `DUST`.
- `EXPLOSION`
- `CLOUD`
- `CRIT`
Suggested sounds:
- `ITEM_MACE_SMASH_GROUND`
- `ENTITY_GENERIC_EXPLODE`
- `BLOCK_STONE_BREAK`
Use sound names valid in the target Paper API.
## STORMFANG
Suggested visuals:
- `ELECTRIC_SPARK`
- `CRIT`
- `END_ROD`
- `DUST` in electric-blue shades.
- Particle-based lightning arcs.
Suggested sounds:
- `ITEM_TRIDENT_THUNDER`
- `ENTITY_LIGHTNING_BOLT_THUNDER`
- `ENTITY_LIGHTNING_BOLT_IMPACT`
Keep visual effects configurable by count, radius, interval, and enabled state.
Do not spawn excessive particles every tick for every nearby player. Use reasonable limits and avoid scanning all entities in the entire world for every ability.
Use localized particle spawning when possible. Make particle effects stop when their owning ability expires.
---
# 12. COMMANDS
Create a main command:
`/legendary`
Optionally support `/lw` as an alias.
Permission checks must be implemented in command handlers, not only declared in `plugin.yml`.
## 12.1 Give a weapon
Syntax:
`/legendary give [amount]`
Permission: `legendaryweapons.admin.give`
Behavior:
- Validate the target player.
- Validate the weapon ID.
- Validate the optional amount.
- Default the amount to 1.
- Restrict the amount to a configurable maximum, default 1 per command execution.
- Create properly identified items.
- Deliver items safely.
- If the inventory is full, drop remaining items at a safe location or report the undelivered quantity according to configuration.
- Record the command sender and recipient in the console log.
Do not use display names as the source of weapon identity.
## 12.2 List weapons
Syntax:
`/legendary list`
Permission: `legendaryweapons.admin`
Display the three weapons and their identifiers.
## 12.3 Check cooldowns
Syntax:
`/legendary cooldowns [player]`
Permission:
- Self: `legendaryweapons.cooldowns.self`
- Other players: `legendaryweapons.admin`
Display active cooldowns for the selected player. When no player is specified, show the sender's cooldowns if the sender is a player.
## 12.4 Reload configuration
Syntax:
`/legendary reload`
Permission: `legendaryweapons.admin.reload`
Behavior:
- Reload and validate configuration.
- Apply valid updated settings.
- Keep active effects and cooldown state safe.
- Do not destroy running task state or duplicate repeating tasks.
- If the new configuration is invalid, report the problem and avoid replacing working settings with unsafe values.
- Confirm successful reload.
## 12.5 Execute ultimate
Syntax:
`/legendary execute`
Permission: `legendaryweapons.ability.execute`
Behavior:
- Require a player sender.
- Require VOIDREAPER in the configured eligible hand.
- Validate the target and cooldown.
- Start the execution mark.
- Provide clear error messages when requirements are not met.
If an optional offhand-swap trigger is enabled, document its behavior and ensure it does not duplicate the command activation.
## Command quality requirements
All commands must have:
- Correct argument validation.
- Permission checks.
- Player-versus-console handling.
- Helpful usage messages.
- Tab completion.
- Configurable messages where practical.
- No uncaught exceptions for invalid user input.
Unknown commands and invalid arguments must return helpful usage information instead of silently failing.
---
# 13. PERMISSIONS
Declare the following permissions in `plugin.yml`:
| Permission | Default | Purpose |
|---|---|---|
| `legendaryweapons.admin` | op | General administration |
| `legendaryweapons.admin.give` | op | Give legendary weapons |
| `legendaryweapons.admin.reload` | op | Reload configuration |
| `legendaryweapons.ability.execute` | true | Use the EXECUTION ultimate |
| `legendaryweapons.cooldowns.self` | true | View personal cooldowns |
| `legendaryweapons.cooldowns.others` | op | View another player's cooldowns |
If an additional `legendaryweapons.admin` permission is declared as a parent, configure inheritance correctly.
Do not grant the general administration permission to everyone.
Players should be able to use the ordinary abilities of a legitimate weapon they possess unless the configuration or a dedicated permission explicitly restricts them.
The EXECUTION ultimate must be usable by ordinary players who possess VOIDREAPER and have the required permission.
Operators should be able to distribute weapons without granting all players administrative privileges.
---
# 14. COMPLETE CONFIGURATION FILE
Create a valid, well-documented `config.yml`.
Do not hardcode gameplay values that should reasonably be adjustable.
Use a structure similar to:
```yaml
settings:
debug: false
cooldowns-persist: false
default-pvp-enabled: true
mob-damage-enabled: true
prevent-self-damage: true
ignore-spectators: true
require-line-of-sight: true
respect-vanilla-pvp-rules: true
max-targets-per-ability: 16
execution:
activation-mode: COMMAND
allow-offhand-swap-trigger: false
cancel-on-weapon-switch: true
cancel-on-world-change: true
cancel-on-caster-death: true
cancel-on-target-death: true
items:
voidreaper:
material: NETHERITE_SWORD
display-name: "VOIDREAPER "
custom-model-data: 10001
unbreakable: true
gravebreaker:
material: MACE
display-name: "GRAVEBREAKER "
custom-model-data: 10002
unbreakable: true
stormfang:
material: TRIDENT
display-name: "STORMFANG "
custom-model-data: 10003
unbreakable: true
abilities:
voidreaper:
cosmic-drain:
enabled: true
healing: 2.0
cooldown-seconds: 5
cosmic-slash:
enabled: true
damage: 6.0
range: 12.0
cooldown-seconds: 15
knockback: 1.0
wall-penetration: false
max-targets: 4
black-hole:
enabled: true
damage-per-tick: 2.0
damage-interval-ticks: 20
duration-seconds: 3
range: 15.0
radius: 4.0
pull-strength: 0.35
cooldown-seconds: 30
execution:
enabled: true
damage: 12.0
range: 12.0
mark-duration-seconds: 3
cooldown-seconds: 60
gravebreaker:
gravity-crash:
enabled: true
damage: 6.0
radius: 6.0
cooldown-seconds: 20
upward-knockback: 0.9
meteor-drop:
enabled: true
max-damage: 10.0
impact-radius: 6.0
cooldown-seconds: 35
launch-velocity: 1.2
stormfang:
thunder-spear:
enabled: true
damage: 6.0
secondary-damage: 3.0
range: 20.0
chain-radius: 4.0
max-chain-targets: 3
cooldown-seconds: 15
tempest:
enabled: true
damage-per-tick: 2.0
damage-interval-ticks: 20
radius: 4.0
duration-seconds: 5
speed-amplifier: 1
cooldown-seconds: 45
effects:
particles-enabled: true
sounds-enabled: true
particle-density: 1.0
max-particles-per-effect: 120
action-bar-enabled: true
messages:
prefix: "[LegendaryWeapons] "
ability-activated: "{ability} activated! "
ability-cooldown: "{ability} ready in {seconds}s. "
no-target: "No valid target found. "
invalid-state: "You cannot use this ability right now. "
no-permission: "You do not have permission. "
execution-marked: "Target marked for EXECUTION! "
execution-expired: "Execution mark expired. "
execution-success: "EXECUTION! "
reload-success: "Configuration reloaded. "
performance:
maximum-active-effects-per-player: 3
maximum-active-effects-global: 100
entity-search-interval-ticks: 2
effect-cleanup-interval-ticks: 20
```
This is a starting configuration, not a substitute for complete implementation.
**The coding agent must validate every setting and implement the corresponding behavior.** Remove or rename settings that are genuinely unsupported rather than leaving misleading options in the file.
Add reasonable limits for damage, ranges, durations, radii, cooldowns, particle counts, and active effects. Prevent negative values, invalid materials, infinite numbers, and configurations that could overload the server.
If an invalid setting is encountered, report its path and use a documented safe default.
Parse display names safely and document the supported text format.
---
# 15. PLUGIN.YML REQUIREMENTS
Create a complete and valid `plugin.yml`.
It must include:
- Plugin name.
- Version.
- Main class.
- Description.
- Author.
- API version appropriate for the target.
- Main command and alias.
- Command descriptions and usage.
- All permission nodes.
- Appropriate permission defaults.
The declared main class must match the actual package and compiled class.
Do not declare nonexistent commands or dependencies.
The plugin must start cleanly on Paper 1.21.11 without missing-class errors.
---
# 16. PERSISTENCE AND PLAYER LIFECYCLE
Weapon identity must be persistent in item metadata.
Temporary ability state must be managed separately from item identity.
Use UUIDs rather than player names for cooldowns, execution marks, and active effects.
Default behavior:
- Weapon identities persist with the items.
- Cooldowns reset after a full server restart.
- Active ability effects do not persist through a restart.
- No temporary task is resumed after a restart.
On player disconnect:
- Remove or safely cancel player-owned temporary abilities according to the ability policy.
- Clear temporary execution state.
- Release references that could cause memory leaks.
- Do not invalidate legitimate weapon items.
On player death:
- Cancel temporary player-owned states that should not survive death.
- Do not delete legitimate weapon identities.
- Do not generate duplicate weapons through death-event handling.
On plugin disable:
1. Cancel all plugin-owned tasks.
2. Remove temporary effects where safe.
3. Clear execution marks.
4. Clear transient ability state.
5. Save any required persistent data.
6. Avoid accessing unloaded worlds or invalid entities.
If persistent cooldowns are enabled, use a safe data file or equivalent storage and handle missing, corrupted, or outdated data gracefully.
---
# 17. EVENT HANDLING AND EXPLOIT PREVENTION
Implement dedicated event listeners and test the following cases:
- Right-click with an ordinary sword.
- Right-click with an unrecognized renamed item.
- Sneak + right-click with each legendary weapon.
- Right-click while interacting with a chest.
- Repeated right-clicks during cooldown.
- Offhand swaps with EXECUTION enabled.
- Weapon switching during an execution mark.
- Moving the weapon between inventory slots.
- Death and respawn during an ability.
- Disconnect during an ability.
- World changes during an ability.
- A target dying or disconnecting during an execution mark.
- Multiple simultaneous ability effects.
- Full inventory during weapon distribution.
- Configuration reload while effects are active.
- Server shutdown while scheduled tasks are running.
- Ability use in protected or PvP-disabled environments.
- Attempts to trigger abilities using ordinary items with copied names or lore.
Prevent:
- Cooldown bypasses.
- Duplicate task creation.
- Duplicate damage from one collision.
- Self-damage from custom abilities.
- Execution target substitution.
- Invalid-entity access.
- Excessive entity scanning.
- Unbounded particle generation.
- Permanent potion-effect corruption.
- Task leaks.
- Unintended block destruction.
- Ability activation from malformed items.
Never trust client-provided display text as proof that an item is legitimate.
---
# 18. PERFORMANCE AND SERVER STABILITY
The plugin must be suitable for a multiplayer SMP.
Requirements:
- Perform Bukkit/Paper world and entity operations on the appropriate server thread unless a specific API explicitly supports asynchronous use.
- Do not run blocking disk or network operations on the main thread.
- Do not scan every entity in every loaded world on each tick.
- Restrict entity searches to the ability's relevant area.
- Use squared distances when practical.
- Reuse centralized managers rather than creating a new repeating task for every trivial effect.
- Ensure all tasks have a bounded lifetime.
- Apply configurable limits to simultaneous effects and targets.
- Stop processing immediately when an effect expires.
- Avoid unnecessary allocations inside frequently repeated tasks.
- Do not disable the server's normal tick loop or alter global tick speed.
If an ability reaches its configured active-effect limit, reject the new activation gracefully and display a configurable message.
Document any remaining performance limitations.
---
# 19. CUSTOMIZATION AND MESSAGES
All three weapons must be visually distinct.
Use configurable display names, lore, particle colors, sounds, damage values, ranges, and cooldown durations.
Default color themes:
- VOIDREAPER: dark purple, black, and violet.
- GRAVEBREAKER: charcoal, dark gray, and purple.
- STORMFANG: electric blue, cyan, and white.
Lore should clearly list the activation method and cooldown for each ability.
Suggested lore:
**VOIDREAPER**
- Cosmic Drain โ Heal 1 heart on a successful eligible hit.
- Cosmic Slash โ Sneak + right-click.
- Black Hole โ Right-click.
- EXECUTION โ `/legendary execute`.
**GRAVEBREAKER**
- Gravity Crash โ Sneak + right-click.
- Meteor Drop โ Right-click while airborne.
**STORMFANG**
- Thunder Spear โ Right-click.
- Tempest โ Sneak + right-click.
Make the lore update when configuration changes if practical, but do not require a server restart merely to rename an item unless that is explicitly documented.
Use consistent formatting and clear messages.
---
# 20. TESTING REQUIREMENTS
Create meaningful automated tests for the components that can be tested independently, including:
- Cooldown expiration calculations.
- Independent cooldown keys.
- Weapon identifier parsing.
- Configuration validation.
- Damage and radius calculations.
- Meteor Drop distance-based damage.
- Execution expiration logic.
Use JUnit or another appropriate testing framework.
If practical, provide an integration-testing procedure using a disposable Paper 1.21.11 server.
The coding agent must execute:
1. A clean build.
2. Automated unit tests.
3. Compilation checks.
4. A check that `plugin.yml` and `config.yml` are included in the JAR.
5. A check that the main class is present in the JAR.
6. A check that the resulting ZIP contains the full source project and build wrapper.
If an integration test cannot be executed, document that limitation explicitly.
Do not claim that the plugin has been tested in-game unless it has actually been run on the specified server.
---
# 21. DOCUMENTATION
Create a complete README containing:
- Plugin overview.
- Supported Minecraft and Paper version.
- Java requirements.
- Build instructions.
- Installation steps.
- All commands.
- All permissions.
- All weapon abilities.
- Activation controls.
- Cooldown defaults.
- Configuration instructions.
- Resource-pack and custom-model-data instructions.
- Troubleshooting.
- Known limitations.
- Build and test results.
Include Windows instructions because many server administrators build plugins on Windows.
Example build commands:
Windows:
```bat
gradlew.bat clean build
```
Linux:
```bash
./gradlew clean build
```
Explain that the resulting plugin JAR should be copied into the Paper server's `plugins` folder.
After the server starts successfully, explain how to use the give commands to distribute the weapons.
Do not require the administrator to compile source code merely to install the finished JAR.
---
# 22. FINAL DELIVERABLES
The final deliverables must include all of the following:
**A. Complete source project**
A full, organized Gradle or Maven project containing every required Java class, resource, build file, test, and document.
**B. Compiled plugin JAR**
`LegendaryWeapons-1.0.0.jar`
The JAR must be generated from the supplied source code, not an unrelated or pre-existing plugin.
**C. Complete ZIP package**
`LegendaryWeapons-Complete.zip`
The ZIP must contain:
- All Java source files.
- Build configuration.
- Gradle Wrapper or complete Maven build setup.
- `plugin.yml`.
- `config.yml`.
- Documentation.
- Tests.
- The compiled plugin JAR, if successfully built.
- Any other required resources.
Do not include temporary caches, unrelated files, local credentials, or unnecessary build directories.
**D. Build and test report**
Report:
- Java version used.
- Paper API version used.
- Build command executed.
- Build success or failure.
- Test results.
- Output JAR location.
- ZIP location.
- Any unverified behavior or known limitations.
If the build fails, fix the errors and rebuild. Do not substitute pseudocode or claim success.
If you cannot run the build, provide the complete project and explicitly state that compilation remains unverified.
---
# 23. FINAL ACCEPTANCE CHECKLIST
The project is complete only when all applicable requirements below are satisfied.
- [ ] The project targets Paper 1.21.11 and Java 21.
- [ ] The project contains all three legendary weapons.
- [ ] Each weapon has the specified abilities and activation inputs.
- [ ] Cosmic Drain heals one heart and has an independent five-second cooldown.
- [ ] Cosmic Slash has the correct range, damage, knockback, and cooldown.
- [ ] Black Hole pulls eligible enemies for three seconds and applies controlled damage.
- [ ] EXECUTION marks a valid target for three seconds and requires a qualifying hit.
- [ ] EXECUTION cannot bypass armor or directly force an instant kill.
- [ ] Gravity Crash applies its configured radial damage and knockback.
- [ ] Meteor Drop launches, detects landing, and applies distance-based impact damage.
- [ ] Thunder Spear damages its primary target and chains to up to three additional enemies.
- [ ] Tempest applies Speed II and controlled periodic damage.
- [ ] Every ability has an independent cooldown.
- [ ] Action-bar feedback and activation/failure sounds work.
- [ ] Genuine weapon identity survives inventory movement and restarts.
- [ ] Administrative commands and permissions work correctly.
- [ ] Tab completion is implemented.
- [ ] All gameplay settings are configurable.
- [ ] No ability unintentionally damages its wielder.
- [ ] Temporary tasks and effects are cleaned up.
- [ ] The plugin respects ordinary server combat rules as far as supported.
- [ ] No required classes, configuration files, or implementations are missing.
- [ ] The source project compiles successfully, if a build environment is available.
- [ ] Automated tests pass, if executable in the supplied environment.
- [ ] The JAR contains the correct plugin metadata and resources.
- [ ] The full project is packaged into a valid ZIP file.
- [ ] Installation and troubleshooting instructions are included.
# FINAL INSTRUCTION
Begin by reviewing the requirements and identifying any API limitations or implementation conflicts. Then implement the entire plugin.
Prioritize correctness, stability, exploit prevention, and complete functionality over unnecessary complexity.
**Do not stop after presenting the implementation plan. Build the actual project, compile it, test it, fix any errors, and create the complete ZIP package whenever your environment supports those operations.**
Return the finished project files and clear links or paths to the generated ZIP and JAR. Include the build and test report, and be honest about any limitations that remain.
The final result must be a complete Minecraft Paper plugin project, not merely an explanation of how to create one.
Create the Paper 1.21.11/Java 21 project scaffold, weapon identity, configuration, and independent cooldowns.
Implement the three weaponsโ abilities, safe damage/targeting, commands, and lifecycle cleanup.
Add focused unit tests and installation/configuration documentation; be explicit about build artifacts this workspace cannot generate.
Created the LegendaryWeapons project files, including the Java 21/Paper 1.21.11 Gradle setup, plugin metadata and configuration, weapon and ability code, commands, tests, and documentation.
Build status: I did not run a build or tests, and no compiled JAR or ZIP was generated here. The project targets Paper API 1.21.11-R0.1-SNAPSHOT; compilation and in-game behavior remain unverified. The implementation also does not directly integrate with region-protection plugins.
To build in Kodari, click Compile in the top bar (on phone: โฎ โ Compile Project), then click Compile in the window. If successful, download the JAR from that window. The source project is present, but a LegendaryWeapons-Complete.zip package was not produced.
package com.soulrift.legendaryweapons;
import com.soulrift.legendaryweapons.ability.AbilityManager;
import com.soulrift.legendaryweapons.ability.CooldownManager;
import com.soulrift.legendaryweapons.command.LegendaryWeaponsCommand;
import com.soulrift.legendaryweapons.listener.WeaponListener;
import com.soulrift.legendaryweapons.service.DamageService;
import com.soulrift.legendaryweapons.weapon.WeaponFactory;
import org.bukkit.plugin.java.JavaPlugin;
public final class LegendaryWeaponsPlugin extends JavaPlugin {
private WeaponFactory weaponFactory;
private CooldownManager cooldownManager;
private DamageService damageService;
private AbilityManager abilityManager;
@Override
public void onEnable() {
saveDefaultConfig();
weaponFactory = new WeaponFactory(this);
cooldownManager = new CooldownManager();
damageService = new DamageService(this);
abilityManager = new AbilityManager(this, weaponFactory, cooldownManager, damageService);
getServer().getPluginManager().registerEvents(new WeaponListener(this, abilityManager, weaponFactory, damageService), this);
LegendaryWeaponsCommand command = new LegendaryWeaponsCommand(this, weaponFactory, cooldownManager, abilityManager);
getCommand("legendary").setExecutor(command);
getCommand("legendary").setTabCompleter(command);
getLogger().info("LegendaryWeapons 1.0.0 enabled.");
}
@Override
public void onDisable() {
if (abilityManager != null) abilityManager.shutdown();
if (cooldownManager != null) cooldownManager.clear();
}
public AbilityManager abilities() { return abilityManager; }
public WeaponFactory weapons() { return weaponFactory; }
}