import { sendPlayerMessage } from "../../../config";
import { lifesteal } from "../../../lifesteal";
import { Command } from "../../handler";


new Command({
    name: `mode`,
    aliases: [`lifestealmode`],
    staffOnly: true,
    code({ player, args }) {
        if (!args[0]) return sendPlayerMessage(player, `§aLifesteal is currently on mode: §l${lifesteal.get(`lifestealmode`)}`);
        if (args[0] === `classic` || args[0] === `normal`) {
            lifesteal.set(`lifestealmode`, `normal`);

            sendPlayerMessage(player, `§8[§a/§8] §aSet lifesteal mode to §fnormal`);
        }
        if (args[0] === `random`) {
            if (!args[1] || !args[2]) return sendPlayerMessage(player, `§8[§cX§8] §cPlease add a range from 3-${lifesteal.get(`maxhearts`)}`);
            if (isNaN(+args[1]) || isNaN(+args[2])) return sendPlayerMessage(player, `§8[§cX§8] §cMust be a number!`);

            lifesteal.set(`lifestealmode`, `random-${args[1]}-${args[2]}`);

            sendPlayerMessage(player, `§8[§a/§8] §aSet lifesteal mode to §frandomized gained hearts (${args[1]}-${args[2]})`);
            return;
        }
        else return sendPlayerMessage(player, `§cInvalid argument`);
    },
});