					import { system, world, Entity, Player } from '@minecraft/server'
import * as minecraft_main_server from "@minecraft/server"

export function CheckForPlayerWear() {
	const players = minecraft_main_server.world.getAllPlayers();
	for (const p of players) {
		const equipment = p.getComponent("minecraft:equippable");
		if (equipment) {
			let headwear = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Head);
			let chest = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Chest);
			let leg = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Legs);
			let footwear = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Feet);
			let rightItem = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Mainhand);
			let leftItem = equipment.getEquipment(minecraft_main_server.EquipmentSlot.Offhand);
			if (headwear) {
				switch (headwear?.typeId) {
					case "redstone:nether_helmet":
						p.addEffect("fire_resistance", 120, { amplifier: 1, showParticles: false });
						break;
					case "redstone:top_hat_helmet":
						p.addEffect("health_boost", 60, { amplifier: 4, showParticles: false });
						break;
					case "redstone:explorer_hat_helmet":
						p.addEffect("haste", 60, { amplifier: 1, showParticles: false });
						break;
					default:

				}

			}
			if (chest) {
				switch (chest?.typeId) {
					case "redstone:rat_skin_chestplate":
						p.addEffect("invisibility", 120, { amplifier: 1, showParticles: false });
						break;
					default:
				}
			}
			if (rightItem) {
				switch (rightItem?.typeId) {
					case "redstone:twilight_luster":
						p.addEffect("night_vision", 120, { amplifier: 1, showParticles: false });
						break;
					default:
				}
			}
			if (headwear == "redstone:inferno_helmet" && chest == "redstone:inferno_chestplate" && leg == "redstone:inferno_leggings" && footwear == "redstone:inferno_leggings") {
				p.addEffect("fire_resistance", 60, { amplifier: 1, showParticles: false });
			}
		}
	}
}