Ibreak Toslol

make me a plugin for purpur 1.21.11 that works like whenever a player kills another player the killed player drops a heart and loses it permanently and whoever rightclicks the heart gains an aditional heart, make it so that the max is 20 hearts and that id a player loses all hearts they get banned dor 3 days, make it super lightweitgh for my 1gb ram server

Kodari AI
KodariSep 1 at 8:56 pm 1
HeartboundCombat
A lightweight Purpur 1.21.11 plugin where PvP kills permanently drop a heart item. The slain player permanently loses one max heart, while the killer can right-click the dropped heart to gain one additional max heart, capped at 20 total. If a player's hearts reach zero, they are automatically banned for 3 days. Optimized for low-memory servers with minimal overhead, using efficient data storage and event handling.
  • Create a lightweight Purpur plugin with persistent per-player heart storage.

  • Add PvP death handling, custom heart drops, right-click consumption, and a 20-heart cap.

  • Apply max health on join/respawn and issue a three-day ban at zero hearts.

Created the lightweight HeartSteal Purpur plugin.

Features:

  • Players start with 10 hearts.

  • Killing another player removes one permanent heart.

  • The victim drops a custom heart item.

  • Right-clicking the item grants one heart.

  • Maximum of 20 hearts.

  • Players reaching zero hearts are banned for 3 days.

  • Heart data persists in plugins/HeartSteal/data.yml.

  • Health is restored correctly after joining and respawning.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 313
src/main/java/com/kodari/heartsteal/HeartStealPlugin.java
package com.kodari.heartsteal;

import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;

public final class HeartStealPlugin extends JavaPlugin {

    private HeartManager heartManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        heartManager = new HeartManager(this);
        getServer().getPluginManager().registerEvents(new HeartListener(this, heartManager), this);
    }

    @Override
    public void onDisable() {
        HandlerList.unregisterAll(this);
        if (heartManager != null) {
            heartManager.save();
        }
    }

    public HeartManager getHeartManager() {
        return heartManager;
    }
}