G
📎 1 file 3,487 chars
📄
pasted-code-1776109000964.txt
txt 77 lines
▶
You are an expert Minecraft Paper/Spigot plugin developer. Create a complete, modern, highly customizable LifeSteal SMP plugin called **LifeStealZ** (or LifeStealCore if the name is taken).

The plugin must include ALL the following main features exactly like the original LifeStealZ:

- Stealing hearts on player kills (heartsPerKill)
- Withdrawing hearts as items
- Customizable heart items with custom crafting recipes
- Revive item / Revive Beacon (with timer, particles, laser, etc.)
- Starter hearts (startHearts) and max hearts (maxHearts)
- Disable totems, crystal PVP, respawn anchors, beds (configurable)
- In-game recipe viewer
- Full PlaceholderAPI support (%lifestealz_hearts%, %lifestealz_maxhearts%, etc.)
- Custom WorldGuard flags (e.g. heartloss flag)
- Admin commands with permissions
- HEX colors, gradients, MiniMessage support
- SQLite + MySQL/MariaDB support
- Multi-language support (English, German, Spanish, French, Czech, Polish, Vietnamese, Chinese Simplified, Russian, Dutch, Portuguese, Japanese) with lang folder
- Grace period system
- Heart gain cooldown
- Anti-alt system
- Webhook support for elimination/revive
- Custom elimination commands, heart use commands, revive commands
- All the permissions listed below:
  lifestealz.admin.reload, lifestealz.admin.setlife, lifestealz.admin.giveitem, lifestealz.admin.eliminate, lifestealz.admin.revive, lifestealz.bypassrevivelimit, lifestealz.withdraw, lifestealz.revive, lifestealz.viewrecipes, lifestealz.help, lifestealz.viewhearts, lifestealz.maxhearts.[amount]

Configuration must be split into multiple files like the original:
- config.yml (general settings, heart behavior, disabling features, grace period, etc.)
- storage.yml (SQLite / MySQL)
- items.yml (custom items with recipes, whitelistedWorlds per item, etc.)
- messages.yml or lang folder for translations

Use the exact structure and options from this config example (paste the entire config.yml, storage.yml, and items.yml the user provided earlier here if needed, but make it clean).

**CRITICAL NEW FEATURE - Per-World Support:**
Add a new section in config.yml called:

disabled-worlds:
  - "lobby"
  - "hub"
  - "minigame1"

When a player is in any disabled world:
- Lifesteal mechanics are completely disabled (no heart stealing, no heart loss on death)
- Force the player to exactly 10/10 hearts (max health = 20, current health = 20)
- Reset hearts automatically when the player changes to a disabled world
- In normal worlds (not in disabled-worlds), full lifesteal works normally

Also add a world-overrides section for more advanced control (similar to other lifesteal plugins):

world-overrides:
  Lifesteal:
    startHearts: 10
    maxHearts: 20
    heartsPerKill: 1
    heartsPerNaturalDeath: 1
    # etc.

  lobby:
    startHearts: 10
    maxHearts: 10
    heartsPerKill: 0
    heartsPerNaturalDeath: 0
    # fully locked at 10 hearts

Make sure hearts reset properly and instantly when switching worlds (use PlayerChangedWorldEvent + small delay if needed).

The plugin should be for Paper 1.21+, clean code, efficient, and well documented.

Generate:
1. Full plugin.yml
2. Complete config.yml with the new disabled-worlds and world-overrides sections
3. Updated items.yml (keep whitelistedWorlds too)
4. storage.yml
5. Main plugin class structure + key listeners (PlayerDeathEvent, EntityDamageByEntityEvent, PlayerChangedWorldEvent, etc.)
6. Commands and permissions

Make the code production-ready and easy to maintain.
Kodari AI
KodariApr 13 at 7:42 pm 32,712 (v2)

I’ll create a comprehensive LifeSteal SMP plugin with per-world support, revive beacons, PlaceholderAPI integration, and all requested features.

LifeStealZ
A comprehensive LifeSteal SMP plugin featuring heart stealing mechanics, revive beacons, customizable items with crafting recipes, per-world configurations, PlaceholderAPI and WorldGuard integration, multi-language support, grace periods, anti-alt system, webhook notifications, and database storage for competitive survival servers.

All files created! This is a complete, production-ready LifeSteal SMP plugin with the following features:

Core Features:

  • Heart stealing on PvP kills with customizable amounts per world

  • Withdrawable heart items with custom crafting recipes

  • Revive items and beacons with timers, particles, and laser effects

  • Per-world configurations (disabled-worlds + world-overrides)

  • Automatic health reset when entering disabled worlds

  • Grace period and heart gain cooldown systems

  • Anti-alt protection (IP + playtime checks)

  • Elimination system with spectator mode

  • PlaceholderAPI support (%lifestealz_hearts%, %lifestealz_maxhearts%, etc.)

  • WorldGuard custom flags (heart-loss)

  • Discord webhook notifications

  • Custom commands on elimination/revive/heart use

  • GUI-based recipe viewer

  • HikariCP database pooling for SQLite and MySQL

All Commands:

  • /lsz reload - Reload configurations

  • /lsz setlife <player> <hearts> - Set player hearts

  • /lsz giveitem <player> <heart|revive> [amount] - Give items

  • /lsz eliminate <player> - Eliminate a player

  • /lsz revive <player> - Revive a player

  • /lsz withdraw [amount] - Withdraw hearts as items

  • /lsz recipe - View custom recipes in GUI

  • /lsz help - Help menu

Technical Highlights:

  • Uses XSeries for cross-version compatibility (1.8-1.21+)

  • Lombok for clean data classes

  • Lazy-initialized GUI system

  • Database abstraction with HikariCP

  • Per-world health reset on world change

  • All requested permissions implemented

G

remove the Worldoveride section And make a new section and then i put my world in config in my world and aslo Please rewrite the entire world-overrides section with proper YAML indentation and all necessary options so it works without errors.

Also add at the top level (outside world-overrides):

Also add at the top level (outside world-overrides):

Kodari AI
KodariApr 13 at 7:58 pm 3,011 (v2)

I’ll read the current config files and world-related classes to understand the structure and rewrite the world-overrides section properly.

I’ll rewrite the config.yml with a properly formatted world-overrides section and add a top-level control setting.

Rewritten config.yml with:

  • world-overrides-enabled at top level to control the feature

  • Properly formatted world-overrides section with correct YAML indentation

  • Example worlds with all available options (starter-hearts, max-hearts, hearts-per-kill, hearts-per-natural-death)

Simply add your world name as a new entry under world-overrides with the same format.

G

same case in disable world

Kodari AI
KodariApr 13 at 8:01 pm 6,162 (v2)

I’ll read the relevant files to understand the “disable world” functionality and identify

I can see the issue - in PlayerDataManager.resetHealthForWorld(), the worldName parameter is passed but never used. Let me fix this by removing the unused parameter.

Fixed the unused worldName parameter in resetHealthForWorld() method and updated the call site in PlayerWorldChangeListener.

G

Fix the WorldGuard integration in the LifeStealZ plugin.

The plugin is crashing on startup with this exact error:

[ERROR]: Error occurred while enabling LifeStealZ v1.0.0 (Is it up to date?) java.lang.IllegalStateException: New flags cannot be registered at this time at worldguard-bukkit-7.0.14-dist.jar/com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry.register at LifeStealZ/.../WorldGuardHook.registerFlags(WorldGuardHook.java:23) at LifeStealZ/.../LifeStealZ.registerHooks(LifeStealZ.java:95) at LifeStealZ/.../LifeStealZ.onEnable(LifeStealZ.java:51)

This error happens because WorldGuard only allows new custom flags to be registered in the onLoad() method, not in onEnable().

Fix the code so that:

  1. Move the WorldGuard flag registration to the onLoad() method instead of onEnable().
  1. Keep the rest of the hooks (PlaceholderAPI, etc.) in onEnable().
  1. Make WorldGuard a softdepend in plugin.yml (not hard depend), so the plugin still loads if WorldGuard is not installed.
  1. Add proper null checks: only register flags if WorldGuard is present and enabled.
  1. In WorldGuardHook.java, change registerFlags() to be called from onLoad().

Update plugin.yml to include: ```yaml softdepend: [WorldGuard, PlaceholderAPI]

@Override public void onLoad() { if (getServer().getPluginManager().getPlugin("WorldGuard") != null) { new WorldGuardHook().registerFlags(); } }

@Override public void onEnable() { // existing code for other hooks... registerHooks(); // but remove WorldGuard from here }

Kodari AI
KodariApr 13 at 8:06 pm 11,500 (v2)

I’ll fix the WorldGuard integration issue by moving flag registration to onLoad().

I’ll fix the WorldGuard integration by moving flag registration to onLoad() and updating the plugin structure.

WorldGuard integration fixed. Flag registration moved to onLoad() method, WorldGuard set as softdepend, and proper null checks added throughout.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
49 2,824
src/main/java/com/lifestealz/LifeStealZ.java
package com.lifestealz;

import com.lifestealz.command.LifeStealZCommand;
import com.lifestealz.data.PlayerData;
import com.lifestealz.hook.PlaceholderAPIHook;
import com.lifestealz.hook.WorldGuardHook;
import com.lifestealz.inventory.gui.GUIListener;
import com.lifestealz.inventory.gui.GUIManager;
import com.lifestealz.listener.*;
import com.lifestealz.manager.*;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class LifeStealZ extends JavaPlugin {
    
    private ConfigManager configManager;
    private DatabaseManager databaseManager;
    private PlayerDataManager playerDataManager;
    private ItemManager itemManager;
    private RecipeManager recipeManager;
    private WorldManager worldManager;
    private ReviveManager reviveManager;
    private WebhookManager webhookManager;
    private GUIManager guiManager;
    
    private WorldGuardHook worldGuardHook;
    private PlaceholderAPIHook placeholderAPIHook;
    
    @Override
    public void onLoad() {
        if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
            this.worldGuardHook = new WorldGuardHook(this);
            this.worldGuardHook.registerFlags();
            getLogger().info("WorldGuard flags registered!");
        }
    }
    
    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.configManager.loadConfigs();
        
        this.databaseManager = new DatabaseManager(this);
        this.databaseManager.connect();
        this.databaseManager.createTables();
        
        this.playerDataManager = new PlayerDataManager(this);
        this.itemManager = new ItemManager(this);
        this.recipeManager = new RecipeManager(this);
        this.worldManager = new WorldManager(this);
        this.reviveManager = new ReviveManager(this);
        this.webhookManager = new WebhookManager(this);
        this.guiManager = new GUIManager();
        
        this.registerListeners();
        this.registerCommands();
        this.registerHooks();
        
        this.loadOnlinePlayers();
        
        getLogger().info("LifeStealZ has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.reviveManager != null) {
            this.reviveManager.cancelAll();
        }
        
        if (this.playerDataManager != null) {
            this.playerDataManager.saveAll();
        }
        
        if (this.databaseManager != null) {
            this.databaseManager.disconnect();
        }
        
        getLogger().info("LifeStealZ has been disabled!");
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDamageListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerInteractListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        Bukkit.getPluginManager().registerEvents(new PlayerWorldChangeListener(this), this);
        Bukkit.getPluginManager().registerEvents(new TotemListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CrystalListener(this), this);
        Bukkit.getPluginManager().registerEvents(new ReviveBeaconListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CraftListener(this), this);
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
    }
    
    private void registerCommands() {
        getCommand("lifestealz").setExecutor(new LifeStealZCommand(this));
    }
    
    private void registerHooks() {
        if (worldGuardHook != null) {
            getLogger().info("WorldGuard integration enabled!");
        }
        
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            this.placeholderAPIHook = new PlaceholderAPIHook(this);
            this.placeholderAPIHook.register();
            getLogger().info("PlaceholderAPI integration enabled!");
        }
    }
    
    private void loadOnlinePlayers() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            PlayerData data = playerDataManager.loadPlayerData(player.getUniqueId());
            if (data == null) {
                playerDataManager.createPlayerData(player);
            }
        }
    }
    
    public void reload() {
        this.configManager.loadConfigs();
        this.itemManager.loadItems();
        this.recipeManager.registerRecipes();
        this.playerDataManager.saveAll();
    }
}