import { world, system, EquipmentSlot } from "@minecraft/server";

system.runInterval(() => {
  for (const player of world.getPlayers()) {
    const getChestplate = (player) => {
      return player.getComponent("equippable").getEquipment(EquipmentSlot.Chest)
        ?.typeId;
    };
    if (
      getChestplate(player) === "pb_plane:parachute" &&
      player.isFalling &&
      player.isSneaking
    ) {
      player.addEffect("slow_falling", 20, {
        amplifier: 5,
        showParticles: false,
      });
      player.applyKnockback(
        0,
        0,
        0,
        0
      );
    }
  }
});
