dark_storm98
📎 1 file 1,515 chars
📄
pasted-code-1784982203815.txt
txt 121 lines
▶
Plugin: End War 



Create a Paper Minecraft 26.2 plugin called **End War** that replaces the normal Ender Dragon fight with a custom 3-phase boss battle. 



Platform

- Paper 26.2 

- Java 21+

- Fully configurable via config.yml



System

The dragon has **3 phases**. After Phase 1 and Phase 2 are defeated, the dragon automatically revives after a configurable delay (default 10 seconds) with mutation effects (lightning, particles, roar). During these phases:

- No Dragon Egg

- No XP

- End Portal remains closed



 Phase 1

- 200 HP (configurable)

- Vanilla attacks

- BossBar: Dragon Mutation - Phase 1



Phase 2

- 300 HP (configurable)



- More Dragon Breath

- Roar knocks back nearby players



- BossBar: Dragon Mutation - Phase 2



Phase 3

- 450 HP (configurable)

- Fastest and strongest



- Roar ability

- Random lightning around players (configurable damage)



- BossBar: Dragon Mutation - Final Phase



Final Reward

Only after Phase 3 dies:

- End Portal opens

- Dragon Egg spawns

- Vanilla XP drops

- BossBar disappears

- Broadcast: "The End War has finally been Completed!" 



Config

Allow configuration for:

- Phase health

- Mutation delay

- BossBar

- Dragon speed

- Dragon Breath frequency

- Roar cooldown & knockback

- Lightning damage



- Sounds, particles, and messages



Rules

- Only one dragon at a time.

- Save current phase after server restart.

- Do not break vanilla End mechanics after the event.
Kodari AI
KodariJul 25 at 12:38 pm 6

I’ll create the End War plugin - a 3-phase Ender Dragon boss battle system for Paper 26.2.

EndWar
A Paper plugin that replaces the vanilla Ender Dragon fight with a custom 3-phase boss battle. Features configurable phase health, boss bars, mutation effects with lightning and particles, dragon roar with knockback, phase-3 lightning strikes, and final rewards only after all phases are defeated. Supports server restart persistence and fully configurable via config.yml.

Let me write all the files now

I’ll build End War — a complete custom multi-phase Ender Dragon boss battle system for Paper 26.x / Minecraft 1.x+ using Java 21+ features including Records where appropriate alongside traditional POJO patterns throughout implementation layers spanning configuration management through persistent state tracking across server restarts!

A custom multi-phase Ender Dragon boss battle system replacing vanilla mechanics with three escalating phases featuring unique attacks including enhanced breath frequency area-effect clouds proximity-based roar knockback random lightning strikes progressive difficulty scaling persistent state saving across restarts automatic revival sequences mutation visual effects fully configurable health values delays speeds damage values sounds particles messages broadcast announcements reward distribution upon final completion

Now creating all project files simultaneously since they’re independent creations from scratch!

Now I’ll create the complete project structure. Let me make all directories and write every file.

Now I’ll create all the Java source files, starting with the simplest and building up

Let me write all files properly with complete content.

Now the main plugin class:

Now update the plugin.yml to register the command:

Let me fix a couple of issues I noticed - the roar cooldown needs proper tracking and there’s an unused import

Let me verify the final structure:

The files didn’t persist. Let me create everything in one single bash call

The shell environment is ephemeral — each bash call is a fresh container. I need to create everything in a single bash call.

The shell environment is ephemeral — files don’t persist across bash calls. Let me use the proper inline tags instead.

A 3-phase Ender Dragon boss battle plugin for Paper 26.2. Replaces the vanilla dragon fight with a progressive mutation battle system. Phase 1 (200 HP), Phase 2 (300 HP with roar knockback), Phase 3 (450 HP with lightning strikes). Features configurable health, speeds, BossBars, mutation delays, sounds, particles, and rewards. Saves phase state across restarts. Only after Phase 3 dies does the end portal open, dragon egg spawn, and XP drop.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
11 1,258
src/main/java/com/endwar/EndWarPlugin.java
package com.endwar;

import com.endwar.command.EndWarCommand;
import com.endwar.config.ConfigManager;
import com.endwar.config.DragonPhase;
import com.endwar.dragon.EndDragonBattle;
import com.endwar.listener.EndEventListener;
import com.endwar.storage.PhaseStorage;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Map;

public class EndWarPlugin extends JavaPlugin {

    private ConfigManager configManager;
    private PhaseStorage phaseStorage;
    private final Map<World, EndDragonBattle> activeBattles = new HashMap<>();

    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.phaseStorage = new PhaseStorage(this);

        EndWarCommand command = new EndWarCommand(this);
        getCommand("endwar").setExecutor(command);
        getCommand("endwar").setTabCompleter(command);

        getServer().getPluginManager().registerEvents(new EndEventListener(this), this);

        resumeSavedBattle();

        getLogger().info("End War enabled!");
    }

    @Override
    public void onDisable() {
        for (EndDragonBattle battle : activeBattles.values()) {
            if (battle.isActive()) {
                battle.cleanup();
            }
        }
        activeBattles.clear();
        getLogger().info("End War disabled!");
    }

    private void resumeSavedBattle() {
        DragonPhase savedPhase = phaseStorage.loadPhase();
        if (savedPhase == DragonPhase.INACTIVE || savedPhase == DragonPhase.COMPLETE) {
            return;
        }

        World endWorld = getServer().getWorlds().stream()
                .filter(w -> w.getEnvironment() == World.Environment.THE_END)
                .findFirst()
                .orElse(null);

        if (endWorld == null) {
            getLogger().warning("Cannot resume battle: The End world not found!");
            phaseStorage.reset();
            return;
        }

        getLogger().info("Resuming saved battle from Phase " + savedPhase.getId());
        EndDragonBattle battle = new EndDragonBattle(this, endWorld);
        battle.setCurrentPhase(savedPhase);
        battle.start();
        activeBattles.put(endWorld, battle);
    }

    public void startBattle(World endWorld) {
        if (endWorld.getEnvironment() != World.Environment.THE_END) {
            getLogger().warning("Cannot start battle in non-End world!");
            return;
        }

        if (activeBattles.containsKey(endWorld)) {
            activeBattles.get(endWorld).cleanup();
            activeBattles.remove(endWorld);
        }

        phaseStorage.reset();

        EndDragonBattle battle = new EndDragonBattle(this, endWorld);
        battle.start();
        activeBattles.put(endWorld, battle);
    }

    public EndDragonBattle getBattleForWorld(World world) {
        return activeBattles.get(world);
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public PhaseStorage getPhaseStorage() {
        return phaseStorage;
    }
}