justpaulius

Imagine your a paper server builder for 1.21 and you need to make this idea work. Work with teh prompt given and make this players dream a reality. Here is the idea written in his perspective: I want a plugin that makes it every 10 levels you get 1 extra heart capping at 20 hearts, but if you die the hearts reset. Also there's a action bar with a XP multiplier. A Xp multiplier is a system that makes your xp multiply. It starts at 1 and ends at 5, although if you die while being at 1x you lose 0.1 from your 1x, but if you die with more then 1x multiplier you lose 0,5x multiplier. If you run out of lives (multipliers) you get banned and you can get revived with expensive crafting recipe for a beacon of life, you can also craft multipliers that's configurable like beacons of life recipe. If you try to revive someone with the beacon it pops up a nicely looking INVENTORY GUI to revive a player that's banned. Tysm and please my my idea a reality.

Kodari AI
KodariApr 17 at 7:50 pm 32,072 (v2)
HeartLife
A survival enhancement plugin where players earn bonus hearts every 10 levels (capped at 20 hearts total), which reset on death. Features an XP multiplier system (1x–5x) displayed on the action bar; dying at 1x or below costs 0.1x, dying above 1x costs 0.5x. Falling to 0x multiplier triggers a server ban. Players can be revived using a craftable Beacon of Life that opens a polished inventory GUI. Craftable XP Multiplier items restore lost multiplier. All recipes are fully configurable.
  • 19 total files: main plugin, 5 managers, 2 listeners, 1 command, GUI framework (5 files), ReviveGUI impl, PlayerData, config/plugin YAMLs, build.gradle

  • Death flow: PlayerDeathEvent → reset heartLevel=0, reduce multiplier; PlayerRespawnEvent → reapply hearts; ban on multiplier ≤ 0

  • ReviveGUI uses the full GUI framework with player skull buttons (36 per page with prev/next navigation), consumes Beacon of Life on successful revive

All 19 files created. Here’s a summary of what was built:

  • PlayerData stores each player’s multiplier, heartLevel, and banned state — persisted to playerdata.yml on quit and plugin disable

  • HeartManager uses XAttribute to set generic.max_health; on death heartLevel resets to 0, and a justDied set in PlayerListener prevents PlayerLevelChangeEvent from immediately restoring hearts before respawn

  • MultiplierManager multiplies XP via PlayerExpChangeEvent, handles death penalty logic (0.5x loss above 1x, 0.1x loss at/below 1x), and drives the action bar every configurable tick interval

  • BanManager sets banned=true in PlayerData and kicks on a 1-tick delay; AsyncPlayerPreLoginEvent blocks re-entry; reviving resets multiplier to 1.0x and heals the player if online

  • RecipeManager reads fully configurable shaped recipes from config.yml using XMaterial and identifies custom items by display name

  • ReviveGUI is a 6-row paginated chest (36 player heads per page) with a glass pane border, info/prev/next nav buttons, and consumes one Beacon of Life on successful revive

  • AdminCommand provides /heartlife reload|give|revive|status for server operators

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
19 1,296
src/main/java/com/plugin/heartlife/HeartLifePlugin.java
package com.plugin.heartlife;

import com.plugin.heartlife.commands.AdminCommand;
import com.plugin.heartlife.inventory.gui.GUIListener;
import com.plugin.heartlife.inventory.gui.GUIManager;
import com.plugin.heartlife.listeners.ItemListener;
import com.plugin.heartlife.listeners.PlayerListener;
import com.plugin.heartlife.managers.BanManager;
import com.plugin.heartlife.managers.HeartManager;
import com.plugin.heartlife.managers.MultiplierManager;
import com.plugin.heartlife.managers.PlayerDataManager;
import com.plugin.heartlife.managers.RecipeManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class HeartLifePlugin extends JavaPlugin {

    private PlayerDataManager playerDataManager;
    private HeartManager heartManager;
    private MultiplierManager multiplierManager;
    private BanManager banManager;
    private RecipeManager recipeManager;
    private GUIManager guiManager;

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

        playerDataManager = new PlayerDataManager(this);
        playerDataManager.loadAll();

        heartManager = new HeartManager(this);
        multiplierManager = new MultiplierManager(this);
        banManager = new BanManager(this);
        recipeManager = new RecipeManager(this);
        guiManager = new GUIManager();

        recipeManager.registerRecipes();

        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
        getServer().getPluginManager().registerEvents(new ItemListener(this), this);
        getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);

        getCommand("heartlife").setExecutor(new AdminCommand(this));

        multiplierManager.startActionBarTask();

        getLogger().info("HeartLife enabled successfully.");
    }

    @Override
    public void onDisable() {
        playerDataManager.saveAll();
        getLogger().info("HeartLife disabled — all player data saved.");
    }
}