📄
pasted-code-1794481542853.txt
txt
615 lines
▶
# Apex Legendaries — Complete PaperMC Plugin Development
Act as an expert Minecraft PaperMC plugin developer specializing in advanced combat mechanics, custom weapon abilities, particle animations, resource-pack integration, and polished inventory GUIs.
Create a fully functional Minecraft plugin named **Apex Legendaries** for **PaperMC 1.21.11**, using Java and Maven.
This must be a complete, production-quality plugin, not pseudocode or a collection of examples.
All weapons, abilities, cooldowns, damage values, effects, animations, and GUI settings must work in-game.
---
# 1. Weapon Registry and Custom Items
Use the modern Paper 1.21.4+ CustomModelDataComponent API.
**IMPORTANT:**
- Do NOT use the deprecated `setCustomModelData(Integer)` method.
- Use `meta.getCustomModelDataComponent().setFloats(List.of(...))`.
- Store a unique weapon ID inside each weapon's PersistentDataContainer using the key `apex_weapon_id`.
- Abilities must ONLY activate when the held item has a valid Apex Legendaries weapon ID.
- Never identify weapons solely through their display names or CustomModelData.
Create the following weapon registry:
| Weapon ID | Material | Custom Model Data | Display Name |
|---|---|---|---|
| sunlight_blade | NETHERITE_SWORD | 1.0f | Sunlight Blade |
| inferno_sickle | NETHERITE_SWORD | 3.0f | Inferno Sickle |
| void_staff | NETHERITE_SWORD | 4.0f | Void Staff |
| sculkbreaker | MACE | 1.0f | Sculkbreaker |
| poseidon | TRIDENT | 1.0f | Poseidon |
Display name colors:
- Sunlight Blade: Gold
- Inferno Sickle: Dark Red
- Void Staff: Dark Purple
- Sculkbreaker: Dark Aqua
- Poseidon: Aqua
All names must use non-italic Adventure Components.
Make weapons unbreakable if configured, and prevent their identities from being lost when items are moved, stored, dropped, or picked up.
The initial requirements mention six weapons, but only five have been specified. Implement these five and leave the registry extensible for a sixth weapon. Do not invent an additional weapon.
# 2. Commands and Permissions
Create the `/apex` command with the following subcommands:
### /apex give
Permission: `apex.admin`
- Give the selected player the specified weapon.
- Support all registered weapon IDs.
- Validate player names and weapon IDs.
- Handle full inventories by dropping the item safely or providing an appropriate message.
- Provide tab completion for online players and all weapon IDs.
### /apex reload
Permission: `apex.admin`
- Reload config.yml.
- Update configurable damage values, cooldowns, effects, and GUI settings.
- Confirm successful reloads.
### /apex gui
Permission: Configurable, with a default of unrestricted access.
Open the Apex Legendaries weapon selection GUI.
Also include helpful command usage messages and permission checks.
# 3. Weapon Abilities
Every weapon must have its own unique abilities, animations, sounds, particles, cooldowns, and damage mechanics.
All ability values must be configurable in config.yml.
Use Adventure Action Bars to display cooldowns cleanly.
Cooldowns must be tracked per player and per ability. Prevent abilities from activating during cooldowns, and ensure they cannot be bypassed by switching items or swapping hands.
## WEAPON 1: SUNLIGHT BLADE
Material: NETHERITE_SWORD
Display name: Gold
Description:
"A radiant blade that cuts through battle with concentrated solar force."
Enchantments:
- Sharpness V
- Looting II
- Unbreaking III
- Mending
### Ability 1: DAWNLINE
Cooldown: 90 seconds
Activation: SNEAK + LEFT CLICK
Description:
"Surge forward in a luminous trail and damage every enemy in your route."
Mechanics:
- Detect the player's facing direction.
- Launch the player forward in a fast solar-powered dash.
- Create a bright golden and yellow particle trail.
- Damage every valid enemy along the dash path.
- Apply configurable damage to each enemy.
- Prevent hitting the same enemy multiple times during one dash.
- Include a satisfying solar activation sound and impact effect.
The dash must feel fast, powerful, and smooth.
### Ability 2: SOLAR VERDICT
Cooldown: 230 seconds
Activation: SNEAK + RIGHT CLICK
Description:
"Control an aimed enemy with radiant force before releasing them from your grasp."
Mechanics:
- Target the enemy the player is looking at.
- Apply a powerful radiant force that suspends and controls the target in the air.
- Create golden solar particles around the target.
- Hold the target temporarily using configurable duration and movement restrictions.
- Release the target with a powerful knockback or downward launch.
- Include a bright solar explosion effect when released.
- Play appropriate charging and release sounds.
Use configurable target range, duration, damage, and knockback.
Use the provided Sunlight Blade screenshot as the reference for the weapon description, enchantments, ability names, cooldown formatting, and lore presentation.
## WEAPON 2: VOID STAFF
Material: NETHERITE_SWORD
Custom Model Data: 4.0f
Theme: Time manipulation, dimensional rifts, and gravitational force.
### Ability 1: RIFT IN TIME
Create a dimensional rift that temporarily anchors all nearby players to the ground.
Mechanics:
- Activate a time-rift effect centered on the caster.
- Affect all players within a configurable 7x7 area.
- Temporarily prevent affected players from moving away.
- Anchor them to the ground using an appropriate movement-restriction mechanic.
- Create a visually impressive time-distortion effect.
- Use dark purple, black, and dimensional particles.
- Play an eerie time-manipulation sound.
- Ensure the effect has a configurable duration.
IMPORTANT:
I will provide custom model effects for this ability later.
Design the ability so custom models, animations, and particle effects can be integrated later without rewriting the ability's core mechanics.
Do not substitute an ordinary particle circle for the future custom model effect.
### Ability 2: GRAVITY COLLAPSE
Slamming the Void Staff sends out a powerful shockwave.
Mechanics:
1. Summon the Void Staff model high above the target area.
2. Animate the staff flying downward toward the ground.
3. Make it slam into the ground with a powerful impact.
4. Generate a large circular shockwave.
5. Apply high-level Levitation to nearby enemies for 1.5 seconds.
6. Immediately afterward, pull affected enemies straight down.
7. Deal configurable heavy fall damage when they hit the ground.
Visual effects:
- Dark purple and black particles.
- Distortion-like rings.
- Ground-impact particles.
- Powerful shockwave animation.
- Dramatic staff descent and impact.
Use appropriate sounds and ensure the animation is synchronized with the damage and status effects.
The slam must look like an actual summoned staff descending from the sky, not simply a normal explosion.
## WEAPON 3: INFERNO SICKLE
Material: NETHERITE_SWORD
Custom Model Data: 3.0f
Theme: Fire, chains, aggressive melee combat.
### Ability 1: BLAZING HOOK
Description: Chain Pull.
Mechanics:
- Throw a visible chain projectile toward the targeted enemy.
- The Inferno Sickle must visually appear attached to the chain.
- Animate the chain extending from the player toward the target.
- When an enemy is hit, pull them toward the player.
- Deal 5 hearts of initial damage.
- Apply true fire damage for 10 seconds.
True fire damage must bypass ordinary armor damage reduction where appropriate, while still respecting configurable protection rules and server safety.
Visual effects:
- Animated chain.
- Inferno Sickle model attached to the chain.
- Fire and ember particles.
- Burning impact effect.
- Powerful chain-retraction animation.
The chain must disappear cleanly after the ability finishes.
### Ability 2: INFERNO CLEAVE
Swinging the Inferno Sickle unleashes a huge horizontal crescent-shaped fire slash.
Mechanics:
- Animate the Inferno Sickle performing a large sword-like horizontal slash in front of the player.
- Generate a wide crescent of fire particles.
- Send the crescent traveling 10 blocks forward.
- Damage multiple enemies along its path.
- The slash must be able to hit several enemies in one activation.
- Enemies already burning receive bonus damage.
IMPORTANT:
The slash must visually use the Inferno Sickle's custom model.
Do not make this a simple fireball, projectile, or ordinary particle burst.
It should look like a massive weapon swing with a visible horizontal fire blade traveling forward.
Visual effects:
- Large orange and red fire crescent.
- Ember trails.
- Burning impact particles.
- Strong weapon-swing sound.
- Additional fire explosion effect on burning enemies.
## WEAPON 4: POSEIDON
Material: TRIDENT
Custom Model Data: 1.0f
Theme: Water manipulation, bubbles, whirlpools, and ocean power.
### Ability 1: TIDAL DASH
Mechanics:
- Launch the player approximately 10 blocks in the direction they are looking.
- Create a spiraling stream of water and bubble particles around the player.
- Must work on dry land as well as underwater.
- Detect enemies collided with during the dash.
- Launch collided enemies upward.
- Deal configurable bonus Impaling-themed damage.
- Prevent repeated collision damage to the same enemy during one activation.
Visual effects:
- Spiraling bubble particles.
- Water splashes.
- Aqua-colored trails.
- Powerful water movement sound.
The ability must feel like a fast underwater-powered dash even when used on land.
### Ability 2: POSEIDON'S WHIRLPOOL
Mechanics:
1. Spawn a spinning water spiral on the ground at the activation location.
2. Use WATER_SPLASH, BUBBLE_POP, and NAUTILUS particles.
3. Create a whirlpool with a configurable 5-block radius.
4. Keep the whirlpool active for 4 seconds.
5. Every 0.25 seconds, detect enemies inside the radius.
6. Gently pull enemies toward the center using a small inward velocity vector.
7. Apply Slowness II while enemies remain inside.
Finisher:
After 4 seconds, collapse the whirlpool.
- Play ENTITY_GUARDIAN_AMBIENT or ENTITY_GENERIC_SPLASH.
- Deal configurable burst magic damage to trapped enemies.
- Launch affected enemies approximately 3 blocks into the air.
- Generate a large water explosion.
- End the effect cleanly.
Make the whirlpool visually impressive, with rotating spiral particle formations rather than a static circle.
## WEAPON 5: SCULKBREAKER
Material: MACE
Custom Model Data: 1.0f
Theme: Warden energy, sculk corruption, powerful ground impacts.
### Ability 1: SCULK ANNIHILATION
Mechanics:
- Summon a large Sculkbreaker mace in the direction the player is looking.
- Animate the mace appearing above the impact location.
- Make the mace descend rapidly and slam into the ground.
- Use the actual Sculkbreaker custom model for the animation.
- Generate a powerful circular ground shockwave.
- Damage enemies within the configured splash-damage radius.
- Create a dramatic ground-impact effect.
- Spawn blocks or block-like visual elements rising from the ground around the impact.
IMPORTANT:
Use the uploaded video as the visual reference.
Recreate the overall visual sequence:
- Large mace descending from above.
- Overhead-style impact presentation.
- Dramatic ground slam.
- Radial impact effects.
- Ground particles and rising block formations.
- Cyan and dark sculk/Warden-themed visual effects.
The effect should feel like a massive Warden-powered weapon strike.
Do not permanently destroy or modify terrain unless explicitly enabled in the configuration.
Prefer temporary block displays, falling block visuals, or other safe visual-only methods.
### Ability 2: WARDEN'S EXECUTION
Mechanics:
- Dash in the direction the player is looking.
- Perform a heavy overhead mace strike.
- Detect the enemy hit by the strike.
- Deal configurable heavy damage.
- Apply powerful knockback.
- If the target is actively holding up a shield, immediately disable or break the shield.
- Shield-breaking ability has its own 5-second cooldown.
- Shield users receive double knockback.
Visual effects:
- Dark aqua and cyan sculk particles.
- Warden-like shockwave.
- Heavy mace impact animation.
- Strong impact sound.
- Ground shockwave particles.
Make the attack feel like a devastating Warden-powered overhead strike.
# 4. Weapon Lore and Item Descriptions
Every weapon must have polished Minecraft item lore.
Include:
- Weapon description.
- Ability names.
- Ability cooldowns.
- Activation instructions.
- Short descriptions of each ability.
Use colored Adventure Components and consistent formatting.
Example Sunlight Blade formatting:
SUNLIGHT BLADE
A radiant blade that cuts through battle with concentrated solar force.
DAWNLINE
90s - SNEAK + LEFT CLICK
Surge forward in a luminous trail and damage every enemy in your route.
SOLAR VERDICT
230s - SNEAK + RIGHT CLICK
Control an aimed enemy with radiant force before releasing them from your grasp.
Make all other weapon descriptions follow this same polished presentation.
# 5. Apex Legendaries GUI
Create a custom 36-slot chest inventory GUI (4 rows).
Command: `/apex gui`
GUI title:
**Apex Legendaries Menu**
Use the provided GUI texture image as the exact visual reference.
The texture features:
- Dark black and purple background.
- Golden borders.
- Decorative golden corner details.
- Gold inventory-slot outlines.
- A purple horizontal separator.
- A fantasy legendary-item menu appearance.
IMPORTANT: The custom GUI texture must be integrated through the resource pack and custom font system. Do not attempt to recreate the texture using ordinary inventory items.
### Custom GUI Texture Integration
No external plugins.
Use Paper's Adventure Component API.
Set the inventory title using white color (`NamedTextColor.WHITE`) so the custom texture is not tinted gray.
Use the negative space character `\uF808` (which equals -8 pixels) followed by the custom GUI font character `\uE001`:
`Component.text("\uF808\uE001", NamedTextColor.WHITE)`
Make the GUI title, horizontal offset, and relevant font positioning configurable in config.yml.
The visible title must say:
**Apex Legendaries Menu**
Ensure the title text and custom background glyph work together without overlapping or shifting the texture incorrectly.
### GUI Layout
Display the available legendary weapons as clickable items.
Each weapon should have:
- Its custom model.
- Its display name.
- A short description.
- Ability information.
- Cooldowns.
- Activation instructions.
Clicking a weapon should display its information or give the player the weapon, depending on a configurable GUI mode.
Use the actual registered weapon items and their CustomModelData values.
Prevent players from taking or moving display items inside this GUI.
Cancel InventoryClickEvent for protected GUI inventories and handle InventoryDragEvent as well.
Identify the custom inventory reliably using an inventory holder or another safe identification method, not only its title.
Prevent GUI exploits involving shift-clicking, number keys, offhand swapping, dragging, and double-click collection.
The GUI must be visually polished and match the supplied texture.
# 6. Configuration System
Create a complete config.yml.
Every weapon must have configurable:
- Ability enable/disable toggles.
- Damage values.
- Cooldowns.
- Effect durations.
- Effect levels.
- Target ranges.
- Splash radii.
- Knockback strengths.
- Dash distances.
- Particle amounts.
- Sound effects.
- Animation durations.
Also include:
- GUI title.
- GUI horizontal offset.
- GUI display mode.
- Weapon availability.
- Debug mode.
- Optional terrain modification.
- Permission settings.
Provide sensible default values matching the abilities described above.
All configuration values must actually be used by the plugin.
Reloading config.yml must update the relevant settings without requiring a server restart.
Validate configuration values and handle invalid or missing values safely.
# 7. Cooldown and Action Bar System
Implement a centralized cooldown manager.
Requirements:
- Track cooldowns individually for every player and ability.
- Display remaining cooldown time in the action bar.
- Use clean, readable formatting.
- Display which ability is currently cooling down.
- Do not spam chat messages.
- Prevent activation while cooling down.
- Support configurable cooldowns.
- Clear appropriate player-specific temporary data when players disconnect.
Example action bar:
`☀ DAWNLINE: 45s`
Use Adventure Components for action bar messages.
# 8. Technical Requirements
Use:
- Java.
- Maven.
- Paper API for Minecraft 1.21.11.
- Adventure Components.
- PersistentDataContainer.
- CustomModelDataComponent.
- Bukkit/Paper events.
- Bukkit scheduler or safe task scheduling.
- Entity and particle APIs.
Important technical requirements:
1. Avoid deprecated APIs wherever possible.
2. Keep all Bukkit world/entity operations on the main server thread unless an API explicitly supports asynchronous access.
3. Do not block the main server thread.
4. Avoid excessive particle spawning.
5. Properly cancel scheduled tasks when abilities end or players disconnect.
6. Prevent abilities from affecting the caster unless explicitly configured.
7. Handle PvP and friendly-fire rules.
8. Prevent repeated damage from the same ability tick.
9. Prevent ability exploits involving item swapping and interaction events.
10. Make all temporary entities and visual effects clean themselves up.
11. Use proper ray tracing and collision detection.
12. Handle player deaths, world changes, disconnects, and plugin shutdown safely.
13. Ensure the plugin does not create permanent unwanted world changes.
14. Ensure all custom items remain identifiable through their PersistentDataContainer.
# 9. Project Structure
Create a clean, modular Maven project.
Suggested structure:
- ApexLegendaries.java
- commands/
- ApexCommand.java
- ApexTabCompleter.java
- weapons/
- WeaponRegistry.java
- WeaponFactory.java
- WeaponManager.java
- abilities/
- AbilityManager.java
- CooldownManager.java
- sunlight/
- voidstaff/
- inferno/
- poseidon/
- sculkbreaker/
- gui/
- ApexGUI.java
- GUIListener.java
- listeners/
- WeaponListener.java
- PlayerListener.java
- config/
- ConfigManager.java
- util/
- ParticleUtils.java
- DamageUtils.java
- EntityUtils.java
- AnimationUtils.java
Include:
- pom.xml
- plugin.yml
- config.yml
- README.md
# 10. Final Deliverables
Provide the complete working source code for the entire plugin.
Do not leave:
- Empty ability methods.
- TODO comments in place of functionality.
- Placeholder damage mechanics.
- Fake animations.
- Missing event listeners.
- Missing configuration options.
- Incomplete commands.
Include all required Java files, Maven dependencies, plugin.yml, and config.yml.
Explain how to:
1. Build the plugin using Maven.
2. Install the resulting JAR.
3. Configure the resource pack.
4. Set up custom model data.
5. Use the commands.
6. Configure damage and cooldowns.
7. Add the future Void Staff custom effects.
The final result must be a fully functional, visually impressive legendary weapon plugin called **Apex Legendaries**.
Prioritize polished animations, responsive combat mechanics, accurate custom models, and a professional GUI.
Add the Maven/Paper project setup, plugin metadata, and configurable defaults.
Implement persistent weapon items, registry, lore, commands, and protected GUI.
Add per-player cooldowns and scheduled combat abilities with cleanup on logout, world change, and shutdown.
Document setup, resource-pack hooks, configuration, and Kodari’s build workflow.
Created the Apex Legendaries Paper plugin project with Maven setup, five persistent weapon definitions, configurable abilities and cooldowns, /apex commands, and a protected 36-slot GUI. Ability effects use scheduled tasks with cleanup on player disconnect, death, world change, and plugin shutdown.
The requested texture and custom weapon art are not included: no image or model assets were attached, and Kodari Studio is disabled for this project. The code includes CustomModelData and the GUI font-glyph hook; enable Studio via Settings → Generation to create the missing art.
To build and install: click Compile in the desktop toolbar (phone: ⋮ → Compile Project), click Compile, then Download and place the JAR in the Paper server’s plugins folder. Restart the server to generate its config.
package com.apexlegendaries;
import com.apexlegendaries.abilities.AbilityManager;
import com.apexlegendaries.abilities.CooldownManager;
import com.apexlegendaries.commands.ApexCommand;
import com.apexlegendaries.gui.GUIListener;
import com.apexlegendaries.listeners.PlayerListener;
import com.apexlegendaries.listeners.WeaponListener;
import com.apexlegendaries.weapons.WeaponFactory;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class ApexLegendaries extends JavaPlugin {
private WeaponFactory weaponFactory;
private CooldownManager cooldownManager;
private AbilityManager abilityManager;
@Override
public void onEnable() {
saveDefaultConfig();
weaponFactory = new WeaponFactory(this);
cooldownManager = new CooldownManager();
abilityManager = new AbilityManager(this, weaponFactory, cooldownManager);
ApexCommand command = new ApexCommand(this, weaponFactory);
Objects.requireNonNull(getCommand("apex"), "apex command missing from plugin.yml").setExecutor(command);
getCommand("apex").setTabCompleter(command);
Bukkit.getPluginManager().registerEvents(new WeaponListener(weaponFactory, abilityManager), this);
Bukkit.getPluginManager().registerEvents(new GUIListener(), this);
Bukkit.getPluginManager().registerEvents(new PlayerListener(abilityManager, cooldownManager), this);
if (getConfig().getBoolean("debug", false)) getLogger().info("Apex Legendaries enabled with " + com.apexlegendaries.weapons.WeaponRegistry.all().size() + " registered weapons.");
}
@Override
public void onDisable() {
if (abilityManager != null) abilityManager.shutdown();
if (cooldownManager != null) cooldownManager.clearAll();
Bukkit.getScheduler().cancelTasks(this);
}
public AbilityManager getAbilityManager() { return abilityManager; }
}