import { world, EquipmentSlot } from "@minecraft/server";
import * as utils from "../utils";

export async function onTick()
{
    try {
        for (const player of world.getPlayers()) {
            const equippable = player.getComponent('equippable');
            if(equippable){
                const chest = equippable.getEquipment(EquipmentSlot.Chest);
                if(chest && chest.typeId == "pu_sg:water_armor"){
                    utils.runPlayerCommand(player, "effect @s water_breathing 11 255 true");
                }
            }
        }
    } catch (e) {
    }
};