shakibff1111-bit

MASTER PROMPT — Raid Captain Ominous Bottle Drop Plugin

You are an expert Minecraft Java and Paper plugin developer.

Create a complete, production-ready Minecraft plugin named:

RaidCaptainDrops

The plugin must be written in Java using the Paper API.

Target Minecraft version:

Minecraft Java Edition 1.21.x

Do NOT provide pseudo-code, incomplete examples, TODO comments, or placeholder methods.

Generate the COMPLETE Maven project with all Java files and configuration files.

---

🎯 MAIN FEATURE

When a Pillager Captain inside an active Raid dies, the plugin must make the Captain drop an Ominous Bottle.

The plugin should work whether the Pillager Captain is killed by:

  • A Player
  • Another Mob
  • Environmental Damage
  • Fall Damage
  • Fire
  • Any other death

As long as the dead entity is a valid Raid Pillager Captain, it should drop the Ominous Bottle.

---

⚔️ RAID CAPTAIN DETECTION

The plugin must:

  1. Listen for entity death events.
  2. Check if the dead entity is a Pillager.
  3. Check if the Pillager is participating in an active Raid.
  4. Check if the Pillager is a Raid Captain.
  5. Only then create and drop the Ominous Bottle.

Do NOT make normal Pillagers drop Ominous Bottles.

Do NOT make Pillager Outpost Captains affected by this plugin unless they are part of an active Raid.

---

🧪 OMINOUS BOTTLE DROP

When a valid Raid Captain dies:

  • Drop an Ominous Bottle naturally at the death location.
  • The bottle must be collectible by players.
  • The bottle should work normally with Minecraft's vanilla Bad Omen system.
  • Do not create fake Bad Omen effects manually unless required by the API.

The plugin should use the correct Minecraft 1.21 Paper API item implementation for:

Ominous Bottle

---

⚙️ CONFIGURATION

Create a complete "config.yml".

Example:

enabled: true

drop: enabled: true

# Drop chance from 0 to 100 chance: 100

# Ominous Bottle level # Supported values: 1 to 5 level: 1

messages: enabled: true bottle-drop: "&aA Raid Captain dropped an Ominous Bottle!"

Requirements:

  • Drop chance must be configurable.
  • Ominous Bottle level must be configurable.
  • Plugin can be enabled or disabled through config.
  • Messages can be enabled or disabled.
  • Invalid config values must automatically use safe defaults.

---

🔄 COMMANDS

Create the command:

/raidcaptain reload

Permission:

raidcaptain.admin

The command must:

  • Reload "config.yml"
  • Apply the new settings immediately
  • Send a success message

Example:

&6RaidCaptainDrops configuration reloaded!

If the player does not have permission:

&cYou don't have permission to use this command!

Console must also be able to execute the reload command.

---

🔐 PERMISSIONS

Add the following permission:

raidcaptain.admin: description: Allows reloading the plugin configuration default: op

---

📁 PROJECT STRUCTURE

Use a clean Maven project structure:

RaidCaptainDrops/ │ ├── pom.xml │ ├── src/ │ └── main/ │ ├── java/ │ │ └── com/ │ │ └── raidcaptain/ │ │ └── drops/ │ │ │ │ │ ├── RaidCaptainDrops.java │ │ ├── listener/ │ │ │ └── RaidCaptainDeathListener.java │ │ │ │ │ └── command/ │ │ └── RaidCaptainCommand.java │ │ │ └── resources/ │ ├── plugin.yml │ └── config.yml

You may add additional classes if necessary.

---

🔧 TECHNICAL REQUIREMENTS

Use:

  • Java 21
  • Paper API
  • Minecraft 1.21.x
  • Maven

The "pom.xml" must:

  • Use the Paper repository.
  • Include the correct Paper API dependency.
  • Build successfully with Maven.
  • Produce a plugin JAR.

Use:

mvn clean package

The final JAR must be placed in:

target/RaidCaptainDrops.jar

---

🛡️ ERROR HANDLING

The plugin must:

  • Never crash if no Raid exists.
  • Never drop bottles from normal Pillagers.
  • Prevent duplicate drops from the same death.
  • Handle null values safely.
  • Handle configuration errors safely.
  • Log useful errors to the console.
  • Work correctly after "/raidcaptain reload".

---

📄 plugin.yml

Include:

  • Plugin name
  • Main class
  • Version
  • API version
  • Commands
  • Permissions

Example command:

commands: raidcaptain: description: RaidCaptainDrops main command usage: /raidcaptain reload

---

🚀 FINAL OUTPUT REQUIREMENTS

Generate ALL files completely.

Provide:

  1. Complete "pom.xml"
  2. Complete main plugin class
  3. Complete Raid Captain listener
  4. Complete command class
  5. Complete "plugin.yml"
  6. Complete "config.yml"
  7. Full project structure
  8. Build instructions

IMPORTANT:

  • No pseudo-code.
  • No incomplete methods.
  • No placeholders.
  • No TODO comments.
  • Use proper Paper 1.21.x API.
  • Make sure Raid Captains inside active Raids correctly drop Ominous Bottles.
  • Ensure the project compiles successfully.

The final plugin must be ready to build and place directly into a Paper server's "plugins" folder.

Kodari AI
KodariSep 7 at 11:53 am 2
RaidCaptainDrops
A Paper plugin that makes Pillager Captains in active raids drop Ominous Bottles. Features configurable drop chance and bottle level, reload command with permission, and safe error handling. Works with all death causes and prevents duplicate drops.
  1. Create the Maven project and Paper 1.21 plugin metadata.

  2. Implement validated configuration loading and reload behavior.

  3. Implement raid-captain detection, configurable Ominous Bottle drops, and command handling.

Created the complete RaidCaptainDrops Maven project.

Project structure

Plain Text
RaidCaptainDrops/
├── pom.xml
└── src/
    └── main/
        ├── java/
        │   └── com/
        │       └── raidcaptain/
        │           └── drops/
        │               ├── RaidCaptainDrops.java
        │               ├── command/
        │               │   └── RaidCaptainCommand.java
        │               └── listener/
        │                   └── RaidCaptainDeathListener.java
        └── resources/
            ├── config.yml
            └── plugin.yml

The plugin includes:

  • Paper API 1.21.4 support

  • Java 21 configuration

  • Active raid Pillager Captain detection

  • Patrol/outpost captains excluded unless participating in an active raid

  • Configurable drop chance

  • Configurable Ominous Bottle level from 1–5

  • Safe defaults for invalid configuration values

  • /raidcaptain reload

  • raidcaptain.admin permission

  • Duplicate death protection

  • Natural bottle drops using OminousBottleMeta

  • Reload-safe settings application

Build

From the project root:

Shell
mvn clean package

The resulting plugin JAR will be located at:

Plain Text
target/RaidCaptainDrops.jar

Copy it into the server’s:

Plain Text
plugins/

directory and restart the Paper server.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
6 317
src/main/java/com/raidcaptain/drops/RaidCaptainDrops.java
package com.raidcaptain.drops;

import com.raidcaptain.drops.command.RaidCaptainCommand;
import com.raidcaptain.drops.listener.RaidCaptainDeathListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class RaidCaptainDrops extends JavaPlugin {
    private static final boolean DEFAULT_ENABLED = true;
    private static final boolean DEFAULT_DROP_ENABLED = true;
    private static final int DEFAULT_CHANCE = 100;
    private static final int DEFAULT_LEVEL = 1;
    private static final boolean DEFAULT_MESSAGES_ENABLED = true;
    private static final String DEFAULT_DROP_MESSAGE = "&aA Raid Captain dropped an Ominous Bottle!";

    private boolean enabled;
    private boolean dropEnabled;
    private int dropChance;
    private int bottleLevel;
    private boolean messagesEnabled;
    private String dropMessage;

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

        Bukkit.getPluginManager().registerEvents(new RaidCaptainDeathListener(this), this);

        RaidCaptainCommand command = new RaidCaptainCommand(this);
        if (getCommand("raidcaptain") == null) {
            getLogger().severe("The raidcaptain command is missing from plugin.yml.");
            return;
        }
        getCommand("raidcaptain").setExecutor(command);
        getCommand("raidcaptain").setTabCompleter(command);
    }

    public void reloadPluginConfig() {
        reloadConfig();
        loadSettings();
    }

    private void loadSettings() {
        enabled = readBoolean("enabled", DEFAULT_ENABLED);
        dropEnabled = readBoolean("drop.enabled", DEFAULT_DROP_ENABLED);

        int configuredChance = readInteger("drop.chance", DEFAULT_CHANCE);
        if (configuredChance < 0 || configuredChance > 100) {
            getLogger().warning("Invalid drop.chance; using " + DEFAULT_CHANCE + ".");
            dropChance = DEFAULT_CHANCE;
        } else {
            dropChance = configuredChance;
        }

        int configuredLevel = readInteger("drop.level", DEFAULT_LEVEL);
        if (configuredLevel < 1 || configuredLevel > 5) {
            getLogger().warning("Invalid drop.level; using " + DEFAULT_LEVEL + ".");
            bottleLevel = DEFAULT_LEVEL;
        } else {
            bottleLevel = configuredLevel;
        }

        messagesEnabled = readBoolean("messages.enabled", DEFAULT_MESSAGES_ENABLED);
        Object configuredMessage = getConfig().get("messages.bottle-drop");
        if (configuredMessage == null) {
            dropMessage = DEFAULT_DROP_MESSAGE;
        } else if (configuredMessage instanceof String message && !message.isBlank()) {
            dropMessage = message;
        } else {
            getLogger().warning("Invalid messages.bottle-drop; using the default message.");
            dropMessage = DEFAULT_DROP_MESSAGE;
        }
    }

    private boolean readBoolean(String path, boolean defaultValue) {
        Object value = getConfig().get(path);
        if (value == null) {
            return defaultValue;
        }
        if (value instanceof Boolean booleanValue) {
            return booleanValue;
        }
        getLogger().warning("Invalid " + path + "; using " + defaultValue + ".");
        return defaultValue;
    }

    private int readInteger(String path, int defaultValue) {
        Object value = getConfig().get(path);
        if (value == null) {
            return defaultValue;
        }
        if (value instanceof Integer integerValue) {
            return integerValue;
        }
        getLogger().warning("Invalid " + path + "; using " + defaultValue + ".");
        return defaultValue;
    }

    public boolean isPluginEnabled() {
        return enabled;
    }

    public boolean isDropEnabled() {
        return dropEnabled;
    }

    public int getDropChance() {
        return dropChance;
    }

    public int getBottleLevel() {
        return bottleLevel;
    }

    public boolean areMessagesEnabled() {
        return messagesEnabled;
    }

    public String getDropMessage() {
        return dropMessage;
    }
}