kirat017

make the plugin from this prompt

📎 1 file 2,741 chars
📄
pasted-code-1787372865586.txt
txt 53 lines
▶
Act as a Senior Minecraft Paper Plugin Developer.

I need a complete, production-ready Paper plugin for Minecraft 1.21.11 (Java 21) named "MagicStars", along with a fully compatible Resource Pack targeting Minecraft 1.21.11 specifications.

Please format the response cleanly with proper file names as code block headers and provide all code files step-by-step.

### 🌟 Plugin Features
Create 6 custom NETHER_STAR items using CustomModelData (1001–1006) and PersistentDataContainer (PDC):
1. Star of Flame (1001): Shoots Fireball + gives Fire Resistance for 30s (15s cooldown).
2. Star of Swiftness (1002): Gives Speed III + Jump Boost II for 15s (20s cooldown).
3. Star of Life (1003): Heals 4 hearts + gives Regeneration II for 8s (30s cooldown).
4. Star of Protection (1004): Gives Resistance III + Absorption II for 10s (45s cooldown).
5. Star of Shadows (1005): Gives Invisibility + Night Vision for 20s (30s cooldown).
6. Star of Wrath (1006): Strikes Lightning on targeted block/entity within 15 blocks (20s cooldown).

---

### 🛠️ Key Technical Requirements
- Language & Target API: Java 21, Paper API 1.21.11.
- Logic: Right-click activation (works in main hand & off-hand, with proper cancellation to prevent double-triggering).
- Cooldowns: UUID-based `HashMap` managed inside `CooldownManager`.
- Item Formatting: Custom display names with MiniMessage/Component colors, custom lore, enchant glint, and hidden flags/attributes.
- Command: `/givestar  ` 
  - Requires permission: `magicstars.admin`
  - Includes full TabCompletion.

---

### 📂 Required Output Files

#### Section 1: Plugin Source Code
Generate fully implemented Java code for:
1. `build.gradle.kts` (or `pom.xml` for Paper 1.21.11)
2. `paper-plugin.yml` (or `plugin.yml`)
3. `Main.java` (Plugin initialization & listener/command registering)
4. `StarItems.java` (ItemStacks creation using PDC & CustomModelData)
5. `StarEvents.java` (Right-click handling & logic execution)
6. `StarCommand.java` (CommandExecutor & TabCompleter)
7. `CooldownManager.java` (Cooldown handling logic)

#### Section 2: Resource Pack Structure & JSON Models (Minecraft 1.21.11 Specs)
1. `pack.mcmeta` (Use correct pack_format 46 for 1.21.11)
2. `assets/minecraft/items/nether_star.json` (Use modern 1.21+ item model overrides for custom_model_data 1001–1006)
3. Individual item model JSON files:
   - `star_flame.json`
   - `star_swiftness.json`
   - `star_life.json`
   - `star_protection.json`
   - `star_shadows.json`
   - `star_wrath.json`

#### Section 3: Visual Project Structure
Provide a clear directory tree for both the Plugin Source project and the Resource Pack (highlighting where to put the six 32x32 PNG textures).
Kodari AI
KodariAug 22 at 4:32 am 2
  1. Create the Gradle/Paper project metadata and plugin descriptor.

  2. Implement star types, item construction, cooldown tracking, event abilities, and /givestar.

  3. Add the 1.21+ resource-pack model definitions and pack metadata.

Implemented the complete MagicStars Paper plugin and resource-pack structure.

Included plugin features

  • Six Nether Star abilities with CustomModelData 1001–1006

  • PersistentDataContainer star identification

  • MiniMessage names and lore

  • Enchantment glint with hidden enchantment/attribute flags

  • Main-hand and off-hand activation handling

  • UUID-based per-star cooldowns

  • Fireball, potion effects, healing, lightning targeting

  • /givestar <player> <type>

  • Permission: magicstars.admin

  • Full player and star-type tab completion

  • Java 21 and Paper 1.21.11 Gradle configuration

Resource-pack texture locations

Add the six 32×32 PNG files here:

Plain Text
resource-pack/assets/magicstars/textures/item/
├── star_flame.png
├── star_swiftness.png
├── star_life.png
├── star_protection.png
├── star_shadows.png
└── star_wrath.png

The model files are already configured to reference those textures.

Kodari can make mistakes. Review important code before using.
Files
resource-pack
src
build.gradle.kts
settings.gradle.kts
Code
17 578
src/main/java/com/magicstars/Main.java
package com.magicstars;

import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {
    private CooldownManager cooldownManager;
    private StarItems starItems;

    @Override
    public void onEnable() {
        NamespacedKey starTypeKey = new NamespacedKey(this, "star_type");
        NamespacedKey starModelKey = new NamespacedKey(this, "star_model");

        this.cooldownManager = new CooldownManager();
        this.starItems = new StarItems(starTypeKey, starModelKey);

        Bukkit.getPluginManager().registerEvents(
                new StarEvents(starItems, cooldownManager),
                this
        );

        PluginCommand giveStarCommand = getCommand("givestar");
        if (giveStarCommand == null) {
            getLogger().severe("The givestar command is missing from paper-plugin.yml.");
            return;
        }

        StarCommand starCommand = new StarCommand(starItems);
        giveStarCommand.setExecutor(starCommand);
        giveStarCommand.setTabCompleter(starCommand);
    }

    @Override
    public void onDisable() {
        if (cooldownManager != null) {
            cooldownManager.clear();
        }
    }
}