irmplayz_
📎 1 file 7,375 chars
📄
pasted-code-1787285437880.txt
txt 255 lines
▶
Create a complete, polished **BloodRain plugin for Paper 1.21.11**.

## 1. Main Commands

Create these **admin/operator-only** commands:

* `/bloodrain start` — Start BloodRain.
* `/bloodrain stop` — Stop BloodRain.
* `/bloodrain status` — Show whether BloodRain is active.
* `/bloodrain INVENTORY GUI` — Open the BloodRain configuration INVENTORY GUI.

## 2. BloodRain Visual System

When BloodRain is active, make the rain look **blood-red and intense**.

### Important:

The goal is for players to visually feel like they are standing in **red/blood-colored rain**, not normal rain.

Implement the best possible visual solution:

* Make the vanilla rain visually appear red if technically possible.
* If Bukkit/Paper cannot directly recolor vanilla rain, use an optimized **red particle-based rain system** that closely follows the falling rain and gives the appearance of red rain.
* Use multiple shades/variations of dark red and bright red particles where appropriate.
* Add subtle red atmospheric particles/mist during BloodRain.
* Add occasional small red splash particles when BloodRain hits the ground.
* Add subtle red screen/environment ambience if possible through supported APIs.
* Do NOT spam huge amounts of particles or cause client/server lag.
* Make particle density configurable.

If an actual red rain texture requires a resource pack, design the plugin so it can optionally work with a custom resource pack, but the plugin must still function without external dependencies.

## 3. BloodRain Exposure Detection

Only players who are actually exposed to the BloodRain should receive its effects.

Do NOT affect players who are:

* Underground.
* Inside a completely covered building.
* Under a solid roof.
* Otherwise protected from the sky/rain.

Accurately detect whether the player has access to the sky and is currently being hit by BloodRain.

## 4. BloodRain Side Effects

Players exposed to BloodRain can receive three configurable effects.

### Hunger Drain

* Hunger should drain faster while exposed to BloodRain.
* The admin must be able to configure exactly how much hunger is removed.
* The admin must also be able to configure the interval between hunger damage.

### Armor Durability Damage

* Equipped armor loses durability while exposed to BloodRain.
* The admin can configure the amount of durability damage.
* Default should be **4–5 durability per damage interval**.
* Allow configurable minimum and maximum values so the admin can choose something like `4–5`.
* Only equipped armor should be affected.
* Never create negative/invalid durability values.

### Heart Damage

* BloodRain can damage the player's health.
* The admin can configure exactly how much health/heart damage is dealt.
* Clearly distinguish between **hearts** and Minecraft **health points** in the INVENTORY GUI.
* Do not bypass normal Minecraft death handling.
* Allow the admin to disable heart damage completely.

## 5. BloodRain Configuration INVENTORY GUI

Create a professional, polished **Minecraft inventory INVENTORY GUI**.

Command:

`/bloodrain INVENTORY GUI`

This INVENTORY GUI should be the main control panel for BloodRain.

### Hunger Configuration

Create a button showing:

* Current hunger damage.
* Current damage interval.
* Whether hunger damage is enabled.

Allow the admin to increase/decrease the values directly through the INVENTORY GUI.

### Armor Configuration

Create a button showing:

* Current armor durability damage.
* Minimum durability damage.
* Maximum durability damage.
* Damage interval.
* Whether armor damage is enabled.

Allow all values to be changed through the INVENTORY GUI.

### Heart Configuration

Create a button showing:

* Current heart damage.
* Damage interval.
* Whether heart damage is enabled.

Allow the admin to change the amount directly through the INVENTORY GUI.

### Visual Configuration

Create a dedicated **Visual Settings** button.

Allow the admin to configure:

* Red rain particle density.
* Rain visual intensity.
* Red atmospheric mist ON/OFF.
* Ground splash particles ON/OFF.
* BloodRain ambience/effects ON/OFF.
* Visual particle range.

### Enable/Disable Toggles

Include clean ON/OFF buttons for:

* Hunger Damage
* Armor Damage
* Heart Damage
* BloodRain Visuals
* Atmospheric Effects
* Ground Splash Effects

Use clear item names, lore, icons and colors so the INVENTORY GUI is easy to understand.

## 6. Save/Apply System

Add a **Save & Apply** button.

When clicked:

* Save all INVENTORY GUI settings.
* Immediately apply them to the active BloodRain event.
* Persist the settings after server restart.
* Save them to `config.yml`.

Also add a **Reset to Defaults** button with a confirmation step.

## 7. INVENTORY GUI Security

The INVENTORY GUI must be **admin/operator only**.

Prevent:

* Taking INVENTORY GUI items.
* Moving INVENTORY GUI items.
* Dropping INVENTORY GUI items.
* Shift-click exploits.
* Item duplication.
* Any inventory manipulation exploits.

All INVENTORY GUI interactions must be safely cancelled and handled.

## 8. Configuration

Create a clean `config.yml` containing all important settings.

Include at minimum:

```yaml
bloodrain:
  hunger:
    enabled: true
    amount: 2
    interval: 5

  armor:
    enabled: true
    min-damage: 4
    max-damage: 5
    interval: 5

  hearts:
    enabled: false
    amount: 1.0
    interval: 5

  visuals:
    enabled: true
    particle-density: 2
    particle-range: 32
    atmosphere: true
    ground-splashes: true
```

The INVENTORY GUI must be able to modify these settings.

## 9. BloodRain Start/Stop Behaviour

When `/bloodrain start` is executed:

* Start the BloodRain event immediately.
* Activate the red rain visuals.
* Activate all enabled side effects.
* Send a suitable BloodRain start message.

When `/bloodrain stop` is executed:

* Stop BloodRain.
* Remove BloodRain visual effects.
* Stop all BloodRain damage tasks.
* Return the world to normal rain/weather behaviour where appropriate.

## 10. Performance

The plugin must be heavily optimized.

* Do not perform expensive calculations every tick.
* Use efficient scheduled tasks.
* Only process players who are online and potentially exposed.
* Avoid excessive particle spawning.
* Make particle density/range configurable.
* Ensure the plugin remains usable on an SMP with multiple players.

## 11. Compatibility

Target:

**Paper 1.21.11**

Include:

* `plugin.yml`
* Complete source code.
* Proper permissions.
* No unnecessary dependencies.
* Clean Bukkit/Paper API implementation.

Make sure the final plugin compiles successfully and all commands, INVENTORY GUI interactions, BloodRain effects, damage mechanics and visual systems work correctly.

### Final Goal

The finished plugin should feel like a **high-quality SMP BloodRain event**, where activating:

`/bloodrain start`

turns the rain into an intense **blood-red storm**, while exposed players suffer configurable **hunger drain, armor durability loss and heart damage**.

The `/bloodrain INVENTORY GUI` should give the server admin complete control over how dangerous and visually intense the BloodRain event is.
Kodari AI
KodariAug 21 at 4:13 am 4
  1. Create the Paper 1.21.11 Gradle project and plugin metadata.

  2. Add persistent settings/configuration management with safe defaults and clamping.

  3. Implement the optimized BloodRain manager for exposure checks, visuals, hunger, armor, and heart effects.

  4. Add operator-only commands and a fully protected multi-page configuration GUI.

Implemented the complete BloodRain Paper 1.21.11 plugin.

  • Added Gradle project setup, plugin.yml, and persistent config.yml.

  • Added /bloodrain start, /bloodrain stop, /bloodrain status, and /bloodrain inventory gui.

  • Implemented optimized red particle rain with configurable density, intensity, range, mist, splashes, and ambience.

  • Added sky-exposure detection to prevent effects underground or under roofs.

  • Added configurable hunger drain, armor durability damage, and heart damage.

  • Added operator-only protected multi-page configuration GUI with:

    • Hunger settings

    • Armor settings

    • Heart/health-point settings

    • Visual settings

    • Enable/disable toggles

    • Save & Apply

    • Reset confirmation

  • Added configuration persistence and immediate application while BloodRain is active.

  • Added inventory click, drag, movement, and duplication protections.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 924
src/main/java/com/kodari/bloodrain/BloodRainPlugin.java
package com.kodari.bloodrain;

import com.kodari.bloodrain.command.BloodRainCommand;
import com.kodari.bloodrain.config.ConfigManager;
import com.kodari.bloodrain.gui.GuiListener;
import com.kodari.bloodrain.manager.BloodRainManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class BloodRainPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private BloodRainManager bloodRainManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);
        configManager.load();
        bloodRainManager = new BloodRainManager(this, configManager);

        Bukkit.getPluginManager().registerEvents(new GuiListener(), this);
        BloodRainCommand command = new BloodRainCommand(this);
        if (getCommand("bloodrain") != null) {
            getCommand("bloodrain").setExecutor(command);
            getCommand("bloodrain").setTabCompleter(command);
        }
    }

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

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public BloodRainManager getBloodRainManager() {
        return bloodRainManager;
    }

    public void openSettings(Player player) {
        new com.kodari.bloodrain.gui.BloodRainGui(this, player).open();
    }
}