kyonog

Create a Minecraft plugin for version 1.21 - 1.21.1 (Paper) featuring a special Crown item with an ability and potion effects. ​Plugin Name: Crown Author: KyonOG ​Key Features: ​Effects (Equip/Unequip): ​Equipping the Crown grants the player Resistance IV and Strength IV. ​Unequipping the Crown immediately removes these effects. ​Ability (Shift + Left-Click): ​Pressing Shift + Left-Click while wearing the crown launches the player into the air, and 100 TNT fall from the sky. ​Activation Rules: ​Both the ability and the potion effects must only work while the Crown is equipped. If the Crown is unequipped, neither the ability nor the effects should work. ​Commands: ​/crown give <player> – Gives the Crown item to the specified player.

Kodari AI
KodariAug 12 at 6:20 pm 1
CrownAbilityPlugin
A Paper plugin for Minecraft 1.21-1.21.1 that adds a special Crown item granting Resistance IV and Strength IV while equipped. Players wearing the Crown can activate a devastating ability by shift-left-clicking, launching themselves into the air while 100 TNT blocks rain from the sky. The plugin tracks armor slot changes to apply and remove potion effects instantly upon equip/unequip, and includes a /crown give command for server administrators to distribute the item.
  1. Create the Paper 1.21.1 Gradle project and plugin metadata.

  2. Implement Crown item creation, equip-state effect management, and TNT ability.

  3. Register /crown give <player>, event listeners, and lifecycle wiring.

Implemented the Paper 1.21–1.21.1 Crown plugin.

  • Added Gradle project setup and plugin.yml.

  • Added Crown item using a persistent item identifier.

  • Wearing the Crown grants Resistance IV and Strength IV.

  • Removing it immediately removes both effects.

  • Shift + left-click while wearing it spawns 100 falling primed TNT.

  • Added /crown give <player> with tab completion.

  • Added inventory tracking and plugin lifecycle cleanup.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 304
src/main/java/com/kyonog/crown/CrownPlugin.java
package com.kyonog.crown;

import com.kyonog.crown.command.CrownCommand;
import com.kyonog.crown.listener.CrownListener;
import com.kyonog.crown.manager.CrownManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class CrownPlugin extends JavaPlugin {
    private CrownManager crownManager;

    @Override
    public void onEnable() {
        this.crownManager = new CrownManager(this);
        this.crownManager.start();

        Bukkit.getPluginManager().registerEvents(new CrownListener(crownManager, this), this);

        CrownCommand crownCommand = new CrownCommand(crownManager);
        Objects.requireNonNull(getCommand("crown")).setExecutor(crownCommand);
        Objects.requireNonNull(getCommand("crown")).setTabCompleter(crownCommand);
    }

    @Override
    public void onDisable() {
        if (crownManager != null) {
            crownManager.stop();
        }
    }
}