import { world, Player, system, EquipmentSlot, Vector, ItemStack } from "@minecraft/server";
import { ActionFormData, FormCancelationReason, ModalFormData } from "@minecraft/server-ui";
import { sendPlayerMessage, sendAllMessage, config } from "../../../config";
import { addScore, deadplayers, getScore, lifesteal, random, randomN, revivelist, setScore } from "../../../lifesteal";
import { Command } from "../../handler";


world.afterEvents.itemUse.subscribe(data => {
    if (data.itemStack.typeId == `lifesteal:heart_of_life`) {
        const player = data.source as Player;
        if (player.runCommand(`clear @s lifesteal:heart_of_life 0 1`).successCount !== 0) {
            addScore(player, `ls-extra-hearts`, 1);
            sendPlayerMessage(player, `§bYou will now recieve one extra heart when getting revived (Permanently)`);
        }
    }
});
