P
📎 1 file 6,726 chars
📄
pasted-code-1790847708209.txt
txt 141 lines
▶
Act as a professional Senior Java Minecraft Plugin Developer for Paper/Spigot 1.21+. 

I need you to write a complete, fully functional, production-ready Minecraft Java Plugin named "Flux-Weapons". Produce clean, modular, efficient, and well-commented code.

Below are the detailed specifications for the project:

---

### 1. PLUGIN OVERVIEW
* **Plugin Name:** Flux-Weapons
* **Main Class:** `me.fluxweapons.FluxWeapons`
* **Target Minecraft Versions:** Native support for 1.21 up to 1.21.4+ (Java 21).
* **API Version:** `1.21`

---

### 2. COMMANDS & PERMISSIONS
* **Base Command:** `/fluxweapons`
* **Command Aliases (ONLY THESE TWO):** `/fweapons`, `/fw`
* **Subcommands:**
  1. `/fluxweapons give  `
     * Gives the specified custom weapon directly to the targeted online player's inventory.
     * `` tab-completes to: `ryzen_blade`, `amber_blade`.
  2. `/fluxweapons reload`
     * Reloads all values, strings, sound settings, and particle options from `config.yml` live without requiring a server restart.
* **Permissions & Access:**
  * Only Server Operators (or players with `fluxweapons.admin` permission) can view, execute, or receive auto-tab-completions for any `/fluxweapons` commands.
  * If a non-OP player attempts to run any subcommand, return the customizable `no-permission` message from `config.yml`.

---

### 3. WEAPON IDENTIFICATION & SMALL-CAPS DESIGN

Both weapons must use `NamespacedKey` and `PersistentDataContainer` (PDC) to identify them accurately regardless of display name changes or renames.

#### Weapon 1: Ryzen Blade (Purple Theme)
* **Base Item:** Netherite Sword
* **Display Name (Small-Caps):** `&#A855F7&lʀ⑵EA&lʏC3AED&lᴢᣞF1&lᴇF46E5&lɴ B5CF6&lʙ&#A855F7&lʟ&#C084FC&lᴀ&#D8B4FE&lᴅ&#E9D5FF&lᴇ` (Vibrant gradient purple/indigo)
* **Attributes & Glow:** PDC identifier tag, custom glowing flag.
* **Lore:** Fully customizable multi-line lore list in `config.yml` using small-caps.

#### Weapon 2: Amber Blade (Yellow Theme)
* **Base Item:** Netherite Sword
* **Display Name (Small-Caps):** `&#FACC15&lᴀ&#EAB308&lᴍ&#CA8A04&lʙ&#A16207&lᴇ&#CA8A04&lʀ &#FDE047&lʙ&#FACC15&lʟ&#EAB308&lᴀ&#CA8A04&lᴅ&#A16207&lᴇ` (Vibrant gradient yellow/gold)
* **Attributes & Glow:** PDC identifier tag, custom glowing flag.
* **Lore:** Fully customizable multi-line lore list in `config.yml` using small-caps.

---

### 4. UNIQUE ABILITIES & MECHANICS

#### Activation Trigger
The ability activates ONLY when a player:
1. Holds the respective weapon in their **main hand**.
2. Is **Crouching (Shift)** AND **Right-Clicks** (air or block).
3. Is **NOT** currently on ability cooldown.

---

#### Ability 1: Ryzen Blade — "Void Pulse Dash" (Purple Theme)
* **Mechanic:**
  * Upon activation, the player launches forward 10–12 blocks in the direction they are facing (with slight upward momentum).
  * As the player dashes, create a trail of purple particles (`SPELL_WITCH`, purple/magenta `DUST`, and `PORTAL`).
  * Upon landing or reaching max distance, trigger a **Void Shockwave Burst** (configurable radius).
  * All enemy entities/players within the radius take damage (configurable) and receive a slight knockback.
* **Visual & Audio Effects:**
  * Plays launch and impact sounds (configurable sound names, volume, and pitch in `config.yml`).
  * Spawns a ring of purple particles around the player at the point of impact.

---

#### Ability 2: Amber Blade — "Solar Flare Vortex" (Yellow Theme)
* **Mechanic:**
  * Upon activation, the player leaps into the air and summons a golden solar vortex around themselves for a short duration (e.g., 3 seconds).
  * During the vortex, nearby hostile mobs and players within a configurable radius are continuously pulled toward the player (gravitational pull) and blinded/slowed.
  * At the end of the duration, a high-intensity **Solar Explosion** explodes outward, dealing heavy damage (configurable) and setting nearby targets on fire.
* **Visual & Audio Effects:**
  * Rotating dual-helix ring of yellow/gold particles (`DUST`, `FLAME`, `END_ROD`) rising upward.
  * Charge-up and explosion sound effects (configurable sound names, volume, and pitch in `config.yml`).

---

### 5. COOLDOWNS & STATE MANAGEMENT
* Cooldown duration is completely configurable per weapon in `config.yml`.
* Active cooldowns are managed via System timestamps (`HashMap` or PDC).
* If a player attempts to use an ability while on cooldown:
  * Cancel the action.
  * Play a configurable failure sound (default: `BLOCK_NOTE_BLOCK_BASS`).
  * Display an action bar message: `{prefix} &c&lᴀʙɪʟɪᴛʏ ᴏɴ ᴄᴏᴏʟᴅᴏᴡɴ! &7ᴡᴀɪᴛ &e%time%s`

---

### 6. FULLY CUSTOMIZABLE `config.yml` (WITH SMALL-CAPS & HEX COLORS)

Provide a complete, fully commented `config.yml` containing:

```yaml
# ======================================================
#             FLUX-WEAPONS CONFIGURATION
# ======================================================

# Plugin Prefix (Supports Hex Colors &#RRGGBB and Legacy &)
prefix: "&8[1FB&lꜰ?F9&lʟDF7&lᴜaF5&lх�B1F3&l-�CBF1&lᴡ�E5EF&lᴇ�FFED&lᴀ�FFED&lᴘ�E5EF&lᴏ�CBF1&lɴ�B1F3&lѕ&8] "

messages:
  no-permission: "%prefix%&cʏᴏᴜ ᴅᴏ ɴᴏᴛ ʜᴀᴠᴇ ᴘᴇʀᴍɪssɪᴏɴ ᴛᴏ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ!"
  player-not-found: "%prefix%&cᴘʟᴀʏᴇʀ &f%player% &cᴡᴀs ɴᴏᴛ ꜰᴏᴜɴᴅ!"
  unknown-weapon: "%prefix%&cɪɴᴠᴀʟɪᴅ ᴡᴇᴀᴘᴏɴ ɴᴀᴍᴇ! ᴜsᴇ: &f/fw give  "
  give-success-sender: "%prefix%&aɢᴀᴠᴇ &f%weapon% &aᴛᴏ &e%player%&a."
  give-success-receiver: "%prefix%&aʏᴏᴜ ʀᴇᴄᴇɪᴠᴇᴅ ᴛʜᴇ &f%weapon%&a!"
  reload-success: "%prefix%&aᴄᴏɴꜰɪɢᴜʀᴀᴛɪᴏɴ sᴜᴄᴄᴇssꜰᴜʟʟʏ ʀᴇʟᴏᴀᴅᴇᴅ!"
  cooldown-actionbar: "&c&lᴀʙɪʟɪᴛʏ ᴏɴ ᴄᴏᴏʟᴅᴏᴡɴ! &7ᴡᴀɪᴛ &e%time%s"

weapons:
  ryzen_blade:
    material: NETHERITE_SWORD
    display_name: "&#A855F7&lʀ⑵EA&lʏC3AED&lᴢᣞF1&lᴇF46E5&lɴ B5CF6&lʙ&#A855F7&lʟ&#C084FC&lᴀ&#D8B4FE&lᴅ&#E9D5FF&lᴇ"
    glowing: true
    cooldown: 15 # in seconds
    damage: 8.0 # HP
    radius: 5.0
    lore:
      - "&7ᴀ ʙʟᴀᴅᴇ ꜰᴏʀɢᴇᴅ ꜰʀᴏᴍ ᴘᴜʀᴇ ᴠᴏɪᴅ ᴇɴᴇʀɢʏ."
      - ""
      - "&e&lᴀʙɪʟɪᴛʏ:"
      - "&fsʜɪꜰᴛ + ʀɪɢʜᴛ ᴄʟɪᴄᴋ &7ᴛᴏ ᴛʀɪɢɢᴇʀ &dᴠᴏɪᴅ ᴘᴜʟsᴇ ᴅᴀsʜ&7."
      - "&7ᴄᴏᴏʟᴅᴏᴡɴ: &e15s"

  amber_blade:
    material: NETHERITE_SWORD
    display_name: "&#FACC15&lᴀ&#EAB308&lᴍ&#CA8A04&lʙ&#A16207&lᴇ&#CA8A04&lʀ &#FDE047&lʙ&#FACC15&lʟ&#EAB308&lᴀ&#CA8A04&lᴅ&#A16207&lᴇ"
    glowing: true
    cooldown: 15 # in seconds
    damage: 10.0 # HP
    radius: 6.0
    lore:
      - "&7ʜᴀʀʙᴏʀs ᴛʜᴇ ʙʟᴀᴢɪɴɢ ʜᴇᴀᴛ ᴏꜰ ᴀ sᴏʟᴀʀ ᴄᴏʟʟᴀᴘsᴇ."
      - ""
      - "&e&lᴀʙɪʟɪᴛʏ:"
      - "&fsʜɪꜰᴛ + ʀɪɢʜᴛ ᴄʟɪᴄᴋ &7ᴛᴏ ᴛʀɪɢɢᴇʀ &e sᴏʟᴀʀ ꜰʟᴀʀᴇ ᴠᴏʀᴛᴇx&7."
      - "&7ᴄᴏᴏʟᴅᴏᴡɴ: &e15s"
Kodari AI
KodariOct 1 at 9:46 am 1
FluxWeapons
A comprehensive Minecraft plugin introducing two unique custom weapons: the Ryzen Blade and Amber Blade. Features include a Void Pulse Dash ability for the Ryzen Blade, launching players forward with purple particle trails and shockwave bursts, and a Solar Flare Vortex for the Amber Blade, creating a golden vortex that pulls enemies and explodes with fire damage. Includes configurable cooldowns, damage, radius, sounds, particles, and messages via config.yml, with admin-only commands for giving weapons and reloading configuration.
  1. Create the Paper 1.21.4/Java 21 project metadata and fully configurable default config.

  2. Add weapon creation/identification, permission-gated commands, and tab completion.

  3. Implement the two abilities, cooldowns, particles, sounds, and interaction handling.

Created the Flux-Weapons Paper plugin with configurable Ryzen and Amber blades, PDC-based weapon identification, operator/admin-only commands, tab completion, cooldowns, and both abilities with configurable sounds and particles.

Project files include the Gradle build, plugin.yml, config.yml, and the Java implementation. Compilation was not run.

P

Hey Why The Ability Is Not Trigger Make If a Entitiy Is In The Users Target Around 8 blocks of range then trigger abilties and also fix the bug make the plugin more optimized

Kodari AI
KodariOct 1 at 9:55 am 1
  1. Fix activation so crouch-right-clicking with a blade only triggers its ability when a target entity is within 8 blocks.

  2. Optimize the ability logic and clean up any related resource/state handling.

Updated ability activation: crouch-right-clicking with either custom blade now triggers only when the player is looking at an entity within 8 blocks.

Also optimized AoE target handling by removing stream/intermediate-list allocations, and cooldown entries are now cleared when a player disconnects. Compilation was not run.

P

Its Still Not Working Fix This Problem The Ability Is Not Triggering

Kodari AI
KodariOct 1 at 9:59 am 1

Fixed ability activation in AbilityListener: it now handles right-click events even if another plugin has already cancelled them, and uses a wider 8-block aim check with a nearby-entity fallback so targets don’t need to be perfectly centered.

Compilation wasn’t run.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 760
src/main/java/me/fluxweapons/FluxWeapons.java
package me.fluxweapons;

import me.fluxweapons.ability.AbilityListener;
import me.fluxweapons.ability.AbilityManager;
import me.fluxweapons.command.FluxCommand;
import me.fluxweapons.weapon.WeaponManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class FluxWeapons extends JavaPlugin {
    private WeaponManager weaponManager;
    private AbilityManager abilityManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        weaponManager = new WeaponManager(this);
        abilityManager = new AbilityManager(this);

        AbilityListener listener = new AbilityListener(weaponManager, abilityManager);
        Bukkit.getPluginManager().registerEvents(listener, this);

        FluxCommand command = new FluxCommand(this, weaponManager);
        Objects.requireNonNull(getCommand("fluxweapons"), "fluxweapons command missing from plugin.yml")
                .setExecutor(command);
        getCommand("fluxweapons").setTabCompleter(command);
    }

    @Override
    public void onDisable() {
        Bukkit.getScheduler().cancelTasks(this);
    }
}