chalhat71
📎 1 file 1,608 chars
📄
pasted-code-1776862091882.txt
txt 40 lines
▶
package com.kannu.multitools.modules;

import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
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;

public class LifestealModule implements Listener {

    @EventHandler
    public void onKill(PlayerDeathEvent e) {
        if (e.getEntity().getKiller() instanceof Player) {
            Player victim = e.getEntity();
            Player killer = victim.getKiller();

            // Steal 2 HP (1 Heart)
            double killerMax = killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
            double victimMax = victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();

            killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(killerMax + 2.0);
            victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(victimMax - 2.0);
            
            killer.sendMessage("§aYou stole a heart from " + victim.getName() + "!");
        }
    }

    @EventHandler
    public void checkIllegalItems(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        // Simple scan for illegal items
        if (p.getInventory().contains(Material.BEDROCK) || p.getInventory().contains(Material.BARRIER)) {
            p.getInventory().remove(Material.BEDROCK);
            p.getInventory().remove(Material.BARRIER);
            p.sendMessage("§cIllegal items were removed from your inventory!");
        }
    }
}
Kodari AI
KodariApr 22 at 12:49 pm 9,233 (v2)

I’ll create a comprehensive MultiTools plugin based on your lifesteal code, with proper XSeries compatibility and modular architecture.

MultiTools
A comprehensive utility plugin featuring multiple survival enhancement modules including lifesteal mechanics, illegal item detection, combat logging prevention, and player head drops. Each module can be independently configured and toggled. Includes customizable hearts stolen per kill, maximum heart limits, configurable illegal items list, and combat tag system to prevent logging during fights.

MultiTools plugin created successfully!

Features implemented:

  • Lifesteal Module: Steals hearts on kill with configurable min/max limits

  • Item Checker Module: Removes illegal items from player inventories on join

  • Combat Log Module: Prevents combat logging with configurable duration and teleport blocking

  • Head Drop Module: Drops player heads on death with configurable chance

  • All modules use XSeries for cross-version compatibility (XAttribute, XMaterial, XSkull)

  • Fully configurable with enable/disable toggles per module

  • /multitools reload command to reload configuration without restart

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 669
src/main/java/com/kannu/multitools/MultiTools.java
package com.kannu.multitools;

import com.kannu.multitools.config.ConfigManager;
import com.kannu.multitools.module.ModuleManager;
import lombok.Getter;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class MultiTools extends JavaPlugin {
    
    private ConfigManager configManager;
    private ModuleManager moduleManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.moduleManager = new ModuleManager(this);
        
        this.moduleManager.loadModules();
        
        getLogger().info("MultiTools has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.moduleManager != null) {
            this.moduleManager.unloadModules();
        }
        
        getLogger().info("MultiTools has been disabled!");
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("multitools")) {
            if (args.length == 0) {
                sender.sendMessage(this.configManager.getMessage("prefix") + " §7Running MultiTools v" + getDescription().getVersion());
                return true;
            }
            
            if (args[0].equalsIgnoreCase("reload")) {
                if (!sender.hasPermission("multitools.reload")) {
                    sender.sendMessage(this.configManager.getMessage("prefix") + " §cYou don't have permission!");
                    return true;
                }
                
                reloadConfig();
                this.configManager = new ConfigManager(this);
                this.moduleManager.reloadModules();
                
                sender.sendMessage(this.configManager.getMessage("reload"));
                return true;
            }
        }
        
        return false;
    }
}