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 head = equippable.getEquipment(EquipmentSlot.Head);
                const chest = equippable.getEquipment(EquipmentSlot.Chest);
                const legs = equippable.getEquipment(EquipmentSlot.Legs);
                const feet = equippable.getEquipment(EquipmentSlot.Feet);
                if(head && chest && legs && feet){
                    if(head.typeId == "pu_sg:rgb_armor_helmet" && chest.typeId == "pu_sg:rgb_armor_chestplate" && legs.typeId == "pu_sg:rgb_armor_leggings" && feet.typeId == "pu_sg:rgb_armor_boots"){
                        utils.runPlayerCommand(player, "effect @s slow_falling 11 1 true");
                        utils.runPlayerCommand(player, "effect @s jump_boost 11 1 true");
                    }
                }
            }
        }
    } catch (e) {
    }
};