import { MessageFormData } from "@minecraft/server-ui";
import { ItemStack } from "@minecraft/server";

export function deleteItem(player, item) {
    const deleteItem = new MessageFormData()
        .title('Delete Item')
        .body(`U want to delete §b${item.typeId.split(':')[1]}`)
        .button1('No')
        .button2('Yes')
        .show(player)
        .then(async evd => {
            if (evd.selection == 1) {
                const replaceItem = new ItemStack('trash:replacer');
                player.getComponent(
                    'inventory'
                ).container.setItem(player.selectedSlot, replaceItem);
                player.sendMessage('[+] §aSuccesfully deleted!');
            }
            else {
                player.sendMessage('[-] §cOperation Cancelled!');
            }
        });
}