notveenuxd

Develop a Minecraft Paper/Spigot plugin for version 1.21+ that introduces a custom item called the "Royal Crown," represented by a golden helmet with unique powers and visual effects. The crown will grant players Strength III, Resistance II, and a maximum health increase to 40 hearts while worn, alongside a rotating golden halo particle effect and a crown emoji indicator in the TAB list. Implement a command /getcrown to give the crown, ensure clean code with no memory leaks, and manage player events to maintain original names and effects upon removal, while also handling shift-click and drag events safely.

Kodari AI
KodariFeb 27 at 5:12 pm 7,414 (v2)

I’ll create a comprehensive Royal Crown plugin with custom item mechanics, effects, particles, and TAB list integration.

RoyalCrownPlugin
A custom item plugin featuring the Royal Crown - a golden helmet that grants powerful buffs, displays a rotating golden halo particle effect, and adds a crown emoji to the player's TAB list name. Includes Strength III, Resistance II, and 40 hearts maximum health while worn. Features clean memory management with automatic restoration of original player states upon crown removal.

Plugin created successfully! Here’s what was implemented:

Features:

  • ✅ Custom Royal Crown item (golden helmet with PDC tagging)

  • ✅ Strength III, Resistance II, and 40 hearts max health

  • ✅ Rotating golden halo particle effect (3 particles in circular motion)

  • ✅ Crown emoji (♔) in TAB list with color customization

  • ✅ /getcrown command with permission system

  • ✅ Clean memory management (stores & restores original player data)

  • ✅ Handles all edge cases: shift-click, drag, drop, armor stand interactions

  • ✅ Automatic cleanup on plugin disable and player quit

  • ✅ Fully configurable via config.yml

  • ✅ Cross-version compatibility using XSeries

Memory Safety:

  • PlayerData stores original TAB names and max health

  • Effects removed on crown unequip with full restoration

  • Particle task cancelled on shutdown

  • All player data cleared on disable

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 521
src/main/java/com/royalcrown/RoyalCrownPlugin.java
package com.royalcrown;

import com.royalcrown.command.CrownCommand;
import com.royalcrown.listener.CrownListener;
import com.royalcrown.manager.CrownEffectManager;
import com.royalcrown.manager.CrownManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class RoyalCrownPlugin extends JavaPlugin {
    private CrownManager crownManager;
    private CrownEffectManager crownEffectManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.crownManager = new CrownManager(this);
        this.crownEffectManager = new CrownEffectManager(this);
        
        registerCommands();
        registerListeners();
        
        getLogger().info("RoyalCrownPlugin has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (crownEffectManager != null) {
            crownEffectManager.shutdown();
        }
        
        getLogger().info("RoyalCrownPlugin has been disabled!");
    }
    
    private void registerCommands() {
        getCommand("getcrown").setExecutor(new CrownCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new CrownListener(this), this);
    }
}