priya9x9

Players start with 5 lives on first join.

Lose 1 life on death.

A customizable Life Item drops when a player dies.

Any player can claim the Life Item by right-clicking it.

Maximum lives: 10.

Additional lives can only be obtained through a custom boss progression system.

Configurable messages, items, and boss rewards.

Kodari AI
KodariJun 17 at 3:48 pm 20
LivesPlugin
A lives system where players start with 5 lives and lose one on each death. A customizable Life Token item drops at the death location for any player to pick up and right-click to claim. Lives cap at 10 and can only be earned beyond starting lives through a configurable boss progression system — bosses can require earlier bosses to be defeated first. Fully configurable messages, life item appearance, and boss rewards via config.yml.

Plan:

  1. PlayerData — data holder (uuid, lives, defeated bosses)

  2. BossConfig — boss definition holder

  3. ConfigManager — typed config access + message formatting

  4. LivesManager — YAML persistence, cache, lives logic

  5. LifeItemManager — create/identify life item via PDC

  6. BossManager — load boss configs, handle kill rewards

  7. PlayerListener — first join, death drop, right-click consume

  8. BossListener — entity death → boss reward

  9. LivesCommand — /lives command + tab completer

  10. LivesPlugin — wire everything together

  11. plugin.yml + config.yml

Here’s a summary of everything built:


Plugin Overview

Commands

Command
Description
/lives
Show your own lives
/lives <player>
Show another player’s lives (
lives.check.others
)
/lives set/add/remove <player> <amount>
Admin management (
lives.admin
)
/lives reload
Reload config + bosses (
lives.admin
)

Life Token System

  • Drops as a world item when a player dies (not from their inventory)

  • Any player picks it up → sits in inventory → right-click to consume → +1 life

  • Fully configurable material, display name, lore, and glow effect

  • Identified via PersistentDataContainer so it survives restarts

Boss Progression

  • Bosses defined in config.yml with entity type, optional custom name, lives reward, and an optional required-boss chain

  • Each boss can only be defeated once per player (no re-farming)

  • Default chain: Ender Dragon → Wither → Elder Guardian

Data

  • Per-player YAML files in plugins/LivesPlugin/playerdata/<uuid>.yml

  • Tracks lives count + which bosses have been defeated

priya9x9

to spawn boss add nether star in brewing stand make a new open in brewing stand craft mobs and add the nether star and take it to inventory

Kodari AI
KodariJun 17 at 3:55 pm 45

Now I have everything. Here’s the full plan:

  • Add iconMaterial to BossConfig + load it in BossManager

  • New BossSpawnItemManager — creates/identifies PDC-tagged boss spawn eggs

  • New BossSpawnGUI — custom 54-slot chest opened instead of real brewing stand UI

  • New BrewingStandListener — intercepts brewing stand clicks, GUI clicks, spawn item use

  • Update BossListener — recognize PDC-tagged boss entities as primary match

  • Wire everything into LivesPlugin

  • Expand config.yml with spawner section + icon materials + new messages

Now patch the existing files:

Now the full updated config.yml:

Now the three new Java files:


Here’s the complete flow:

How It Works

Crafting a Boss Spawn Item

  1. Right-click any Brewing Stand in the world → vanilla UI is suppressed, Boss Spawner GUI opens instead

  2. The top-center slot shows the cost (1 Nether Star) and instructions

  3. Each boss occupies a slot in the middle rows showing: entity type, lives reward, prerequisite, and current unlock status

  4. Click a boss → 1 Nether Star is removed from your inventory and you receive a Boss Spawn Item (identified by PDC, un-fakeable)

Spawning & Defeating the Boss 5. Right-click (air or block) while holding the spawn item → boss entity is summoned at your location, tagged internally via PDC 6. Kill it → BossListener matches it by PDC tag (reliable, no name typo issues), checks prerequisite chain, awards lives once per player

GUI States per Boss

State
Icon text
Not yet unlocked (prereq missing)
✘ Locked
+ which boss to defeat first
Available
✦ Click to craft spawn item
Already defeated
✔ Already defeated
(can still spawn, but no second reward)

Config

  • boss-spawner.gui-title — GUI window title

  • boss-spawner.spawn-item-name/lore — appearance of the spawn item

  • Per-boss icon-material — material shown in GUI and used as spawn item base

  • All player-facing strings under messages.boss-spawner-*

priya9x9

and add command do withdraw life /wl number

Kodari AI
KodariJun 17 at 3:56 pm 9

Now I have everything. Creating the WithdrawCommand and wiring it up:


/wl <amount> — withdraws lives as physical Life Token items placed directly into your inventory.

Rules enforced:

  • Must be a player (no console)

  • Amount must be a positive integer

  • You must keep at least 1 life — you can never withdraw yourself to 0

  • Can’t withdraw more lives than you currently have

  • Each withdrawn life becomes a pickupable Life Token item (same PDC-tagged item that drops on death — fully right-clickable by anyone)

Messages (all configurable in config.yml):

Key
When shown
withdraw-not-player
Console tries to run it
withdraw-invalid-amount
Bad/missing number
withdraw-not-enough
Amount exceeds current lives
withdraw-min
Would drop you to 0 or below
withdraw-success
Withdrawal successful
priya9x9

make sure to make life crystal and the warden who has 100 hearts and damage 2 heart per hit

Kodari can make mistakes. Review important code before using.
Files
src
Code
16 1,376
src/main/java/com/kodari/lives/LivesPlugin.java
package com.kodari.lives;

import com.kodari.lives.commands.LivesCommand;
import com.kodari.lives.commands.WithdrawCommand;
import com.kodari.lives.listeners.BossListener;
import com.kodari.lives.listeners.BrewingStandListener;
import com.kodari.lives.listeners.PlayerListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class LivesPlugin extends JavaPlugin {

    @Getter private static LivesPlugin instance;

    @Getter private ConfigManager configManager;
    @Getter private LivesManager livesManager;
    @Getter private LifeItemManager lifeItemManager;
    @Getter private BossManager bossManager;
    @Getter private BossSpawnItemManager bossSpawnItemManager;

    @Override
    public void onEnable() {
        instance = this;

        saveDefaultConfig();

        configManager = new ConfigManager(this);
        livesManager = new LivesManager(this);
        lifeItemManager = new LifeItemManager(this);
        bossManager = new BossManager(this);
        bossSpawnItemManager = new BossSpawnItemManager(this);

        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
        getServer().getPluginManager().registerEvents(new BossListener(this), this);
        getServer().getPluginManager().registerEvents(new BrewingStandListener(this), this);

        LivesCommand livesCommand = new LivesCommand(this);
        getCommand("lives").setExecutor(livesCommand);
        getCommand("lives").setTabCompleter(livesCommand);

        WithdrawCommand withdrawCommand = new WithdrawCommand(this);
        getCommand("wl").setExecutor(withdrawCommand);
        getCommand("wl").setTabCompleter(withdrawCommand);

        getLogger().info("LivesPlugin enabled. Max lives: " + configManager.getMaxLives()
                + ", Starting lives: " + configManager.getStartingLives());
    }

    @Override
    public void onDisable() {
        if (livesManager != null) {
            livesManager.saveAll();
        }
        getLogger().info("LivesPlugin disabled. All player data saved.");
    }
}