Zac Grogan

create a plugin for paper 26.2 java so when you die, you get banned for 1 day. also make the hearts the hardcore hearts and make the ban message in red bold "YOU DIED"

Kodari AI
KodariSep 6 at 3:07 am 1
DeathBanSystem
A hardcore-style death ban plugin for Paper 26.2. When a player dies, they are immediately banned for 24 hours with a red bold "YOU DIED" ban message. The plugin converts player hearts to hardcore-style hearts, displaying them as the iconic hardcore heart texture. Includes configurable ban duration, automatic unban after the time expires, and proper event handling to prevent bypasses. Integrates seamlessly with the server's ban system and provides clear feedback to players upon death.

I’ll create the Paper plugin with:

  1. A Gradle build targeting Paper 26.2.

  2. A death listener that bans the player for 24 hours and kicks them with the red bold YOU DIED message.

  3. World initialization hooks that enable hardcore hearts for existing and newly loaded worlds.

Created the Paper plugin:

  • Bans players for 1 day upon death.

  • Kicks them with the red, bold message YOU DIED.

  • Enables hardcore hearts for existing, initializing, and newly loaded worlds.

  • Targets Paper 26.2 with Java 21.

Zac Grogan

edit this mod to prevent people from being banned if they die in a certian world or dismention. make /dprot that only opps can use and make it stop anyone from being banned if they die in any world or dismension. also do /pvp false and /pvp true so stop player pvp in a certian world or dismention

Kodari AI
KodariSep 6 at 3:35 am 1
  1. Add /dprot as an OP-only per-world death-ban protection toggle.

  2. Add /pvp true|false as a per-world PvP toggle.

  3. Persist both settings and wire them into death and PvP event handling.

  1. /dprot: OP-only toggle for the current world. Players who die there will not be banned.

  2. /pvp true|false: Enables or disables PvP in the current world, including projectile attacks.

  3. Settings persist in config.yml.

  4. Death protection and PvP settings apply per world/dimension.

Commands:

Plain Text
/dprot
/pvp true
/pvp false

Updated:

  • DeathBanPlugin.java

  • plugin.yml

  • Added config.yml

Zac Grogan

create a command that is /hc off / on that turns off death bans and turns them on in all worlds and dismensions and also create a lifesteal command thats /ls off / on that turns on lifesteal mode. if /lf is on, when someone dies, they lose a heart if they were killed by a player and the player that killed them gets a heart. if a player has 0 hearts, they will be permanently banned from the server until an opped player does /revive <player> or <@a>. /hc and /lf will only be used by opps.

Kodari AI
KodariSep 6 at 3:57 am 1
  1. Add OP-only /hc on|off and /ls on|off global toggles.

  2. Add player-kill heart transfer and permanent zero-heart bans.

  3. Add OP-only /revive <player> / /revive <@a> and register all commands.

  1. Added OP-only /hc on|off to globally enable or disable one-day death bans across all worlds and dimensions.

  2. Added OP-only /ls on|off with /lf alias to toggle lifesteal mode.

  3. Lifesteal now:

    • Removes one heart from a player killed by another player.

    • Gives one heart to the killer.

    • Permanently bans players who reach zero hearts.

  4. Added OP-only /revive <player> and /revive @a to restore players to 10 hearts and remove their permanent ban.

  5. Lifesteal heart counts persist in config.yml.

  6. Preserved per-world death protection and PvP controls.

Zac Grogan

remove the pvp addon

Kodari AI
KodariSep 6 at 3:59 am 1
  1. Remove the PvP damage listener and world-based PvP logic.

  2. Remove the /pvp command registration and handler.

  3. Remove the PvP section from config.yml while preserving death protection, hardcore bans, and lifesteal.

Removed the PvP addon:

  • Removed PvP damage cancellation.

  • Removed /pvp true|false.

  • Removed PvP configuration.

  • Preserved /dprot, /hc, /ls//lf, lifesteal, and /revive.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 301
src/main/java/com/example/deathban/DeathBanPlugin.java
package com.example.deathban;

import java.time.Duration;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.Date;

import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

import com.cryptomorin.xseries.XAttribute;

public final class DeathBanPlugin extends JavaPlugin implements Listener {

    private static final String DEATH_MESSAGE = ChatColor.RED + "" + ChatColor.BOLD + "YOU DIED";
    private static final long BAN_DURATION_MILLIS = Duration.ofDays(1).toMillis();
    private static final int DEFAULT_HEARTS = 10;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(this, this);

        for (World world : Bukkit.getWorlds()) {
            world.setHardcore(true);
        }
    }

    @EventHandler
    public void onWorldInit(WorldInitEvent event) {
        event.getWorld().setHardcore(true);
    }

    @EventHandler
    public void onWorldLoad(WorldLoadEvent event) {
        event.getWorld().setHardcore(true);
    }

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        if (isLifestealEnabled()) {
            Player killer = player.getKiller();
            if (killer != null && !killer.getUniqueId().equals(player.getUniqueId())) {
                int victimHearts = Math.max(0, getHearts(player) - 1);
                int killerHearts = getHearts(killer) + 1;
                setHearts(player, victimHearts);
                setHearts(killer, killerHearts);

                if (victimHearts == 0) {
                    permanentlyBan(player);
                    return;
                }
            }
        }

        if (!isHardcoreDeathBanEnabled() || isDeathProtected(player.getWorld())) {
            return;
        }
        Date expires = new Date(System.currentTimeMillis() + BAN_DURATION_MILLIS);

        Bukkit.getBanList(BanList.Type.NAME).addBan(player.getName(), DEATH_MESSAGE, expires, getName());
        player.kickPlayer(DEATH_MESSAGE);
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        setHearts(event.getPlayer(), getHearts(event.getPlayer()));
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("dprot")) {
            if (!(sender instanceof Player player)) {
                sender.sendMessage(ChatColor.RED + "Only players can use this command.");
                return true;
            }
            if (!player.isOp()) {
                player.sendMessage(ChatColor.RED + "Only operators can use this command.");
                return true;
            }

            String path = "death-protection.worlds";
            java.util.List<String> worlds = getConfig().getStringList(path);
            String worldName = player.getWorld().getName();
            if (worlds.contains(worldName)) {
                worlds.remove(worldName);
                player.sendMessage(ChatColor.YELLOW + "Death bans are enabled in " + worldName + ".");
            } else {
                worlds.add(worldName);
                player.sendMessage(ChatColor.GREEN + "Death bans are disabled in " + worldName + ".");
            }
            getConfig().set(path, worlds);
            saveConfig();
            return true;
        }

        if (command.getName().equalsIgnoreCase("hc")) {
            if (!isOp(sender)) {
                sender.sendMessage(ChatColor.RED + "Only operators can use this command.");
                return true;
            }
            if (args.length != 1 || (!args[0].equalsIgnoreCase("on") && !args[0].equalsIgnoreCase("off"))) {
                sender.sendMessage(ChatColor.RED + "Usage: /hc <on|off>");
                return true;
            }

            boolean enabled = args[0].equalsIgnoreCase("on");
            getConfig().set("hardcore-death-bans.enabled", enabled);
            saveConfig();
            sender.sendMessage((enabled ? ChatColor.GREEN : ChatColor.YELLOW)
                    + "Death bans are now " + (enabled ? "enabled" : "disabled") + " in all worlds and dimensions.");
            return true;
        }

        if (command.getName().equalsIgnoreCase("ls")) {
            if (!isOp(sender)) {
                sender.sendMessage(ChatColor.RED + "Only operators can use this command.");
                return true;
            }
            if (args.length != 1 || (!args[0].equalsIgnoreCase("on") && !args[0].equalsIgnoreCase("off"))) {
                sender.sendMessage(ChatColor.RED + "Usage: /ls <on|off>");
                return true;
            }

            boolean enabled = args[0].equalsIgnoreCase("on");
            getConfig().set("lifesteal.enabled", enabled);
            saveConfig();
            sender.sendMessage((enabled ? ChatColor.GREEN : ChatColor.YELLOW)
                    + "Lifesteal is now " + (enabled ? "enabled" : "disabled") + ".");
            return true;
        }

        if (command.getName().equalsIgnoreCase("revive")) {
            if (!isOp(sender)) {
                sender.sendMessage(ChatColor.RED + "Only operators can use this command.");
                return true;
            }
            if (args.length != 1) {
                sender.sendMessage(ChatColor.RED + "Usage: /revive <player|@a>");
                return true;
            }

            if (args[0].equalsIgnoreCase("<@a>") || args[0].equalsIgnoreCase("@a")) {
                Set<UUID> players = new HashSet<>();
                for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
                    players.add(player.getUniqueId());
                }
                if (getConfig().isConfigurationSection("lifesteal.hearts")) {
                    players.addAll(getConfig().getConfigurationSection("lifesteal.hearts").getKeys(false).stream()
                            .map(UUID::fromString).toList());
                }
                for (UUID uuid : players) {
                    revive(Bukkit.getOfflinePlayer(uuid));
                }
                sender.sendMessage(ChatColor.GREEN + "All players have been revived.");
                return true;
            }

            Player target = Bukkit.getPlayerExact(args[0]);
            OfflinePlayer offlineTarget = target != null ? target : Bukkit.getOfflinePlayer(args[0]);
            if (offlineTarget == null || (!offlineTarget.hasPlayedBefore() && target == null)) {
                sender.sendMessage(ChatColor.RED + "Player not found.");
                return true;
            }
            revive(offlineTarget);
            sender.sendMessage(ChatColor.GREEN + offlineTarget.getName() + " has been revived.");
            return true;
        }

        return false;
    }

    private boolean isDeathProtected(World world) {
        return getConfig().getStringList("death-protection.worlds").contains(world.getName());
    }

    private boolean isHardcoreDeathBanEnabled() {
        return getConfig().getBoolean("hardcore-death-bans.enabled", true);
    }

    private boolean isLifestealEnabled() {
        return getConfig().getBoolean("lifesteal.enabled", false);
    }

    private boolean isOp(CommandSender sender) {