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


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:filled_lapis_vial") {
            player.runCommandAsync("xp 1l")
        }
    })


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:lapis_vial') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function lapisvial");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:cryo_bridge_staff') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommandAsync("function cryobridgestaff");
    }
    else {
        player.onScreenDisplay.setActionBar('Item on Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:weather_radar") {
            player.runCommandAsync("summon item:weather_radar")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:lunar_starfruit") {
            player.runCommandAsync("summon item:lunar_starfruit")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:sunlight") {
            player.runCommandAsync("time set day")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:cloud_in_a_bottle") {
            player.runCommandAsync("function cloudbottle")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:cloud_in_a_bottle_2") {
            player.runCommandAsync("function cloudbottle2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:combustion_potion") {
            player.runCommandAsync("summon mechanic:combustion_blast")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:combustion_potion_2") {
            player.runCommandAsync("summon mechanic:combustion_blast_2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:lethal_venom_potion") {
            player.runCommandAsync("effect @s instant_damage 45")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:stormshock_potion") {
            player.runCommandAsync("summon lightning_bolt")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:stormshock_potion_2") {
            player.runCommandAsync("function stormshock")
        }
    })



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:cryocore_potion") {
            player.runCommandAsync("function cryocore")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:cryocore_potion_2") {
            player.runCommandAsync("function cryocore2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:moonlight") {
            player.runCommandAsync("time set night")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:enchanted_droplet") {
            player.runCommandAsync("weather rain")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:solar_starfruit") {
            player.runCommandAsync("summon item:solar_starfruit")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_solar_starfruit") {
            player.runCommandAsync("summon item:enchanted_solar_starfruit")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:solar_potion") {
            player.runCommandAsync("summon item:solar_potion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:solar_potion_2") {
            player.runCommandAsync("summon item:solar_potion_2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_lunar_starfruit") {
            player.runCommandAsync("summon item:enchanted_lunar_starfruit")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:lunar_potion") {
            player.runCommandAsync("summon item:lunar_potion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:lunar_potion_2") {
            player.runCommandAsync("summon item:lunar_potion_2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:solar_potion_2") {
            player.runCommandAsync("summon item:solar_potion_2")
        }
    })


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wooden_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blackstone_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:stone_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:copper_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});



world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:iron_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:titanium_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});



world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:arkose_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:diamond_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blushie_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:netherite_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:gold_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:sapphire_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_monolith_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:molybdenum_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:enduranium_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:nether_quartz_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:amethyst_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ascendant_war_hammer")) {
        attacker?.runCommandAsync('function level7wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:dragonite_war_hammer")) {
        attacker?.runCommandAsync('function level6wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_war_hammer")) {
        attacker?.runCommandAsync('function level6wave');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:ender_mirror') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("summon mechanic:mirror_checker");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:ascendant_and_steel") {
            player.runCommandAsync("function ascendantignite")
        }
    })


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:bucket_of_horizon_fish') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function mobbucket");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:wand_of_dimensional_rest') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function dimensionalrest");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:wand_of_dimensional_rest_2') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function dimensionalrest2");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'staff:monolith_staff') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function astralmonolith");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:wooden_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage3");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:gold_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage3");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:stone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:copper_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:iron_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:arkose_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:diamond_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:blushie_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:netherite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:sapphire_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:astral_monolith_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:molybdenum_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:nether_quartz_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:amethyst_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:enduranium_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage8");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:dragonite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage9");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:astral_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage9");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});




world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:ascendant_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage11");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:ascendant_apple") {
            player.runCommandAsync("function ascendantapple")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:ascendant_plum") {
            player.runCommandAsync("function ascendantplum")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:ascendant_mango") {
            player.runCommandAsync("function ascendantmango")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:haste_potion") {
            player.runCommandAsync("effect @s haste 180 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:haste_potion_2") {
            player.runCommandAsync("effect @s haste 90 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:haste_potion_extended") {
            player.runCommandAsync("effect @s haste 480 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:haste_potion_primevel") {
            player.runCommandAsync("effect @s haste 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:conduit_power_potion") {
            player.runCommandAsync("effect @s conduit_power 180 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:horizon_fish") {
            player.runCommandAsync("tp @s ~ -70 ~")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:conduit_power_potion_2") {
            player.runCommandAsync("effect @s conduit_power 90 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:conduit_power_potion_extended") {
            player.runCommandAsync("effect @s conduit_power 480 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:conduit_power_potion_primevel") {
            player.runCommandAsync("effect @s conduit_power 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:resistance_potion") {
            player.runCommandAsync("effect @s resistance 180 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:resistance_potion_2") {
            player.runCommandAsync("effect @s resistance 90 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:resistance_potion_extended") {
            player.runCommandAsync("effect @s resistance 480 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:health_boost_potion") {
            player.runCommandAsync("effect @s health_boost 180 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:health_boost_potion_2") {
            player.runCommandAsync("effect @s health_boost 90 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:health_boost_potion_extended") {
            player.runCommandAsync("effect @s health_boost 480 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:resistance_potion_primevel") {
            player.runCommandAsync("effect @s resistance 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:healing_potion_primevel") {
            player.runCommandAsync("effect @s instant_health 1 2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:rejuvenation_potion") {
            player.runCommandAsync("function rejuvenationpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:rejuvenation_potion_2") {
            player.runCommandAsync("function rejuvenationpotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:acceleration_potion") {
            player.runCommandAsync("function accelerationpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:acceleration_potion_2") {
            player.runCommandAsync("function accelerationpotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:might_potion") {
            player.runCommandAsync("function mightpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:worm_hole_potion") {
            player.runCommandAsync("function wormholepotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:worm_hole_potion_2") {
            player.runCommandAsync("function wormholepotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:pulsar_potion") {
            player.runCommandAsync("function pulsarpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:pulsar_potion_2") {
            player.runCommandAsync("function pulsarpotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:event_horizon_potion") {
            player.runCommandAsync("function eventhorizonpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:event_horizon_potion_2") {
            player.runCommandAsync("function eventhorizonpotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:leverage_potion_2") {
            player.runCommandAsync("function mightpotion2")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:strength_potion_primevel") {
            player.runCommandAsync("effect @s strength 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:jump_boost_potion_primevel") {
            player.runCommandAsync("effect @s jump_boost 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:speed_potion_primevel") {
            player.runCommandAsync("effect @s speed 480 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:launch_potion") {
            player.runCommandAsync("effect @s levitation 1 75")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:launch_potion_2") {
            player.runCommandAsync("effect @s levitation 1 120")
        }
    })

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:snowmill') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function snowmill");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:golden_plum") {
            player.runCommandAsync("function goldenplum")
        }
    })



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_plum") {
            player.runCommandAsync("function enchantedplum")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:absorption_potion") {
            player.runCommandAsync("effect @s absorption 180 3")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:absorption_potion_2") {
            player.runCommandAsync("effect @s absorption 60 5")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:absorption_potion_extended") {
            player.runCommandAsync("effect @s absorption 600 3")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:aurora_potion") {
            player.runCommandAsync("summon mechanic:aurora_spawner")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:abyss_aurora_potion") {
            player.runCommandAsync("summon mechanic:abyss_aurora_spawner")
        }
    })


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:wooden_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:stone_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:iron_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:gold_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:diamond_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:netherite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:steel_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:redstone_crystal_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:ecto_fragment") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:redstone_statue") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function redstonestatue`)
})

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:hero_potion_extended") {
            player.runCommandAsync("effect @s village_hero 60 0")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:emerald_apple") {
            player.runCommandAsync("function emeraldapple")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:hero_potion") {
            player.runCommandAsync("effect @s village_hero 30 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:hero_potion_2") {
            player.runCommandAsync("effect @s village_hero 15 1")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:blindness_potion") {
            player.runCommandAsync("effect @s blindness 15 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:blindness_extended") {
            player.runCommandAsync("effect @s blindness 30 0")
        }
    })



world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:torchlight_staff") {
            player.runCommandAsync("function torchlight")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:ecto_fragment") {
            player.runCommandAsync("clear @s item:ecto_fragment 1 0")
        }
    })


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:victory_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound victoryhorn @a[r=256]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:golden_cherry") {
            player.runCommandAsync("function goldencherry")
        }
    })



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_cherry") {
            player.runCommandAsync("function enchantedcherry")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:nausea_potion") {
            player.runCommandAsync("effect @s nausea 15 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:nausea_potion_extended") {
            player.runCommandAsync("effect @s nausea 30 0")
        }
    })


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:sickle") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:grass_block") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function sickle`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:sickle") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:dirt") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function sickle`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:sickle") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:podzol") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function sickle`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:sickle") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:grass_path") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function sickle`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:sickle") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:mycelium") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function sickle`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:wheat") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function wheatglove`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:carrots") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function carrotglove`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:beetroot") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function beetrootglove`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:potatoes") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function potatoglove`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:cotton_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:cotton_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:pepper_plant_6") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:pepper_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:pepper_plant_5") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:pepper_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:pepper_plant_4") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:pepper_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:pepper_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:pepper_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:tomato_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:tomato_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:corn_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:corn_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:ender_dragon_fruit_block") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:ender_dragon_fruit_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:ender_melon_block") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:ender_melon_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:void_pumpkin") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:void_pumpkin_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:fuzzy_carrot_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:fuzzy_carrot_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:cloud_straw_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:cloud_straw_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:distorted_cabbage_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:distorted_cabbage_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:blushie_wart_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:blushie_wart_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:chorus_lavender_tile") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:chorus_lavender_1 destroy`)
})

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:coffee_plant_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:coffee_plant_1 destroy`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:garden_glove") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:lettuce_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:lettuce_1 destroy`)
})


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:wooden_scythe') {

        target.runCommandAsync('summon mechanic:scythe_2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:gold_scythe') {

        target.runCommandAsync('summon mechanic:scythe_2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:stone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:flint_scythe') {

        target.runCommandAsync('summon mechanic:scythe_3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:copper_scythe') {

        target.runCommandAsync('summon mechanic:scythe_3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:iron_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:diamond_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:resin_dipped_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:netherite_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wooden_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ice_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:arkose_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:copper_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});

world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wooden_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:stone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:brimstone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blackstone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:iron_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:diamond_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:netherite_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:emerald_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ruby_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:obsidian_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:pyro_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:gold_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:citrine_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:copped_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});




world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "staff:nether_wind_staff") {
            player.runCommandAsync("function netherwindstaff")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:infernal_potion") {
            player.runCommandAsync("function infernalpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:infernal_potion_2") {
            player.runCommandAsync("function infernalpotion2")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:eldritch_potion") {
            player.runCommandAsync("function eldrichpotion")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:eldritch_potion_2") {
            player.runCommandAsync("function eldrichpotion2")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:plasma_potion") {
            player.runCommandAsync("summon mechanic:plasma_potion")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:plasma_potion_2") {
            player.runCommandAsync("summon mechanic:plasma_potion_2")
        }
    })


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:apprentices_spell_tome') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function brimstonemagic");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker.getComponent('equippable').getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:souling_gold_sword') {

        target.runCommandAsync('effect @s wither 5 3');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:darkness_potion") {
            player.runCommandAsync("effect @s darkness 15 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:darkness_potion_extended") {
            player.runCommandAsync("effect @s darkness 30 0")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:warden_strength_potion") {
            player.runCommandAsync("function wardenstrength")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:warden_strength_potion_2") {
            player.runCommandAsync("function wardenstrength2")
        }
    })

world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker.getComponent('equippable').getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:wither_bone_sword') {

        target.runCommandAsync('effect @s wither 5 0');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:lapis_bottle') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function lapisbottle");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:bottle_of_enchantment") {
            player.runCommandAsync("xp 5l")
        }
    })


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'staff:echo_staff') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function echostaff");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'music:ancient_flute') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("summon mechanic:flute_randomizer");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wooden_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:stone_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:copper_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:iron_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bronze_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:scorpion_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:diamond_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:topaz_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:netherite_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:amber_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:golden_mango") {
            player.runCommandAsync("function goldenmango")
        }
    })



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:antivenom_potion") {
            player.runCommandAsync("function antivenom")
        }
    })



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_mango") {
            player.runCommandAsync("function enchantedmango")
        }
    })



world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_6") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_1 replace block:zen_sand_6`)
})

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_5") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_6 replace block:zen_sand_5`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_4") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_5 replace block:zen_sand_4`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_4 replace block:zen_sand_3`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_2") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_3 replace block:zen_sand_2`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_sand_1") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_2 replace block:zen_sand_1`)
})

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:sand") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_sand_1 replace sand`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_6") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_1 replace block:zen_red_sand_6`)
})

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_5") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_6 replace block:zen_red_sand_5`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_4") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_5 replace block:zen_red_sand_4`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_3") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_4 replace block:zen_red_sand_3`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_2") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_3 replace block:zen_red_sand_2`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:zen_red_sand_1") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_2 replace block:zen_red_sand_1`)
})

world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "item:zen_rake") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "minecraft:red_sand") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run fill ~~~ ~~~ block:zen_red_sand_1 replace red_sand`)
})



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:stone_energizer') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function energizerfire");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:magnet') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("tp @e[type=item,r=30] @s");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:heros_sword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function herossword");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'item:enchanted_magnet') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function magnet");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});



world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:mustard_gas_bottle") {
            player.runCommandAsync("kill @s")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:aether_potion") {
            player.runCommandAsync("function aetherpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:aether_potion_2") {
            player.runCommandAsync("function aetherpotion")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:mining_potion") {
            player.runCommandAsync("function miningpotion")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:trumpet") {
            player.runCommandAsync("function trumpet")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:titanium_clarinet") {
            player.runCommandAsync("function clarinet")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:aether_fruit") {
            player.runCommandAsync("effect @s slow_falling 15 0")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:cobalt_gong") {
            player.runCommandAsync("function gong")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:staballoy_drum") {
            player.runCommandAsync("function drum")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:rose_gold_harmonica") {
            player.runCommandAsync("function harmonica")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:platinum_harp") {
            player.runCommandAsync("function harp")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:trumpet") {
            player.runCommandAsync("function trumpet")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:whistle") {
            player.runCommandAsync("function whistle")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:copper_bell") {
            player.runCommandAsync("function cowbell")
        }
    })


world.afterEvents.itemUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:exodium_guitar") {
            player.runCommandAsync("function guitar")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:rose_gold_apple") {
            player.runCommandAsync("function rosegoldapple")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:rose_gold_mango") {
            player.runCommandAsync("function rosegoldmango")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:rose_gold_plum") {
            player.runCommandAsync("function rosegoldplum")
        }
    })

world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:rose_gold_acai") {
            player.runCommandAsync("function rosegoldendraplum")
        }
    })


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:magnet_pickaxe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run tp @e[type=item,r=1.5] @p`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:magnet_axe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run tp @e[type=item,r=1.5] @p`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:magnet_shovel") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run tp @e[type=item,r=1.5] @p`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:magnet_hoe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run tp @e[type=item,r=1.5] @p`)
    } catch (e) { }
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:red_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function redfireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:orange_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function orangefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:yellow_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function yellowfireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:lime_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function limefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:cyan_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function cyanfireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:light_blue_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function lightbluefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:blue_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function bluefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:magenta_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function magentafireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:purple_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function purplefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:pink_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function pinkfireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:white_firework_fountain") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function whitefireworkfountain`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:super_tnt") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function supertnt`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:formidi_bomb") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function formidibomb`)
})


world.afterEvents.itemUse.subscribe((e) => {
    const itemStack = e.itemStack
    if (itemStack.typeId != "minecraft:flint_and_steel") return
    const player = e.source
    const block = player.getBlockFromViewDirection({ maxDistance: 10 }).block
    if (block.typeId != "block:catalyst_bomb") return
    player.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function catalystbombspawn`)
})


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:amber_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:amethyst_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ascendant_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aurora_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});



world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blushie_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:deepslate_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:dragonite_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:enduranium_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:flint_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lapis_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:molybdenum_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:nether_quartz_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:resin_dipped_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:sapphire_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:scorpion_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:souling_gold_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:surge_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:titanium_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wither_bone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:dragonite_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lapis_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:amethyst_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:arkose_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ascendant_claymore")) {
        attacker?.runCommandAsync('function claymore7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aurora_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blushie_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bone_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:deepslate_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:emerald_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:enduranium_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:flint_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ice_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:molybdenum_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:nether_quartz_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:obsidian_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:pyro_claymore")) {
        attacker?.runCommandAsync('function claymore7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:resin_dipped_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ruby_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:sapphire_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:scorpion_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:souling_gold_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:gold_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:surge_claymore")) {
        attacker?.runCommandAsync('function claymore7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:titanium_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wither_bone_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bone_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:deepslate_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:flint_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ice_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lapis_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:obsidian_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bone_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:arkose_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:pyro_war_hammer")) {
        attacker?.runCommandAsync('function level7wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aurora_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:resin_dipped_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ruby_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:scorpion_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:souling_gold_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:wither_bone_war_hammer")) {
        attacker?.runCommandAsync('function level6wave');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:emerald_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:arkose_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:obsidian_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:ruby_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:ice_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:amber_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:aurora_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:deepslate_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:bone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:flint_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:lapis_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:resin_dipped_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:scorpion_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:souling_gold_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:titanium_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:wither_bone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:surge_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage11");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:pyro_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage11");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:amber_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aurora_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:amethyst_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:arkose_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ascendant_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:blushie_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:bone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:copper_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:deepslate_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:dragonite_scythe') {

        target.runCommandAsync('summon mechanic:scythe_8');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:nether_quartz_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:obsidian_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:pyro_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ruby_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:sapphire_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:scorpion_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:souling_gold_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:surge_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:titanium_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:wither_bone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:emerald_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:molybdenum_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:enduranium_scythe') {

        target.runCommandAsync('summon mechanic:scythe_7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ice_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:lapis_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});



world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_anger_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound angerhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_clear_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound clearhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_desire_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound desirehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_dry_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound dryhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_falling_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound fallinghorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_fire_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound firehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_fresh_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound freshhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_great_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound greathorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_humble_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound humblehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_hymn_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound hymnhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_journey_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound journeyhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_lake_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound lakehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_memory_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound memoryhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_nest_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound nesthorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_old_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound oldhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});

world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_pure_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound purehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_resting_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound restinghorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:harmony_secret_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound secrethorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_sky_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound skyhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_tear_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound tearhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_temper_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound temperhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:base_thought_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound thoughthorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_urge_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound urgehorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'horn:melody_water_copper_horn') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("playsound waterhorn @a[r=100]");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:steel_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:starlite_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:staballoy_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:solar_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:palladium_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:brimstone_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_claymore")) {
        attacker?.runCommandAsync('function claymore5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:rose_gold_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:platinum_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:moonstone_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:meteorite_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lunar_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:luminite_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:kyanite_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:jasper_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ghost_crysta;_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:exodium_claymore")) {
        attacker?.runCommandAsync('function claymore7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:comet_claymore")) {
        attacker?.runCommandAsync('function claymore7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echoed_copper_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echo_shard_claymore")) {
        attacker?.runCommandAsync('function claymore4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:cobalt_claymore")) {
        attacker?.runCommandAsync('function claymore2');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:citrine_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:blackstone_claymore")) {
        attacker?.runCommandAsync('function claymore1');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_monolith_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aquamarine_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aetherium_claymore")) {
        attacker?.runCommandAsync('function claymore3');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:solar_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:rose_gold_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:platinum_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:palladium_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:moonstone_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:meteorite_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lunar_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:luminite_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:kyanite_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:jasper_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ghost_crystal_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:exodium_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echo_shard_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echoed_copper_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:comet_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:cobalt_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:astral_monolith_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aquamarine_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aetherium_battle_axe")) {
        attacker?.runCommandAsync('function battleaxes');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:wither_bone_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:topaz_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:titanium_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:surge_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:starlite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:staballoy_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:souling_gold_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:solar_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:scorpion_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:sapphire_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ruby_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:rose_gold_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:pyro_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:resin_dipped_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:platinum_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:palladium_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:obsidian_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:nether_quartz_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:moonstone_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:molybdenum_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:meteorite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:lunar_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:luminite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:lapis_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:kyanite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:jasper_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ice_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ghost_crystal_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:flint_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:comet_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:exodium_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:enduranium_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:emerald_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:echoed_copper_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:echo_shard_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:dragonite_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:deepslate_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:cobalt_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:citrine_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:bronze_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:brimstone_morning_star') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:bone_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:blushie_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:blackstone_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aurora_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:astral_monolith_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ascendant_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:arkose_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aquamarine_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:amethyst_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aetherium_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:astral_morningstar') {

        target.runCommandAsync('tp @s ^^^');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:topaz_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:steel_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:starlite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:staballoy_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:solar_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage9");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:rose_gold_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:platinum_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:palladium_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage9");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:moonstone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:meteorite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:lunar_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:luminite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage8");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:kyanite_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:jasper_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:ghost_crystal_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:exodium_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage11");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:comet_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage11");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:echoed_copper_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:echo_shard_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage7");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:cobalt_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:citrine_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:bronze_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage5");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:brimstone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage9");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:blackstone_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage4");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:aquamarine_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.itemUse.subscribe(data => {
    const {itemStack: item, source: player} = data;
    if(item.typeId !== 'sword:aetherium_longsword') return;
    const cooldown = item.getComponent('cooldown');
    const remainingCooldown = cooldown?.getCooldownTicksRemaining(player);
    if(remainingCooldown === 0) {
        cooldown.startCooldown(player); 
        player.runCommand("function longsworddamage6");
    }
    else {
        player.onScreenDisplay.setActionBar('Item On Cooldown');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:topaz_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:steel_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:starlite_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:staballoy_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:solar_war_hammer")) {
        attacker?.runCommandAsync('function level6wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:platinum_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:palladium_war_hammer")) {
        attacker?.runCommandAsync('function level6wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:moonstone_war_hammer")) {
        attacker?.runCommandAsync('function level3wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:meteorite_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:lunar_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:luminite_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:kyanite_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:jasper_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:ghost_crystal_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:exodium_war_hammer")) {
        attacker?.runCommandAsync('function level7wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echo_shard_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:echo_shard_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:comet_war_hammer")) {
        attacker?.runCommandAsync('function level7wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:cobalt_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:citrine_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:bronze_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:brimstone_war_hammer")) {
        attacker?.runCommandAsync('function level5wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aquamarine_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId.includes("sword:aetherium_war_hammer")) {
        attacker?.runCommandAsync('function level4wave');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:topaz_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:steel_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:staballoy_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:solar_scythe') {

        target.runCommandAsync('summon mechanic:scythe_8');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:platinum_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:palladium_scythe') {

        target.runCommandAsync('summon mechanic:scythe_8');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:moonstone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:meteorite_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:lunar_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:luminite_scythe') {

        target.runCommandAsync('summon mechanic:scythe_7');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:kyanite_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:jasper_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:ghost_crystal_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:exodium_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:echoed_copper_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:echo_shard_scythe') {

        target.runCommandAsync('summon mechanic:scythe_6');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:comet_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:citrine_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:cobalt_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:bronze_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});

world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:brimstone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_10');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:blackstone_scythe') {

        target.runCommandAsync('summon mechanic:scythe_4');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:astral_scythe') {

        target.runCommandAsync('summon mechanic:scythe_8');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:astral_monolith_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aquamarine_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'sword:aetherium_scythe') {

        target.runCommandAsync('summon mechanic:scythe_5');
    }
});


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker.getComponent('equippable').getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'spear:souling_gold_spear') {

        target.runCommandAsync('effect @s wither 5 3');
    }
});

world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker.getComponent('equippable').getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'spear:wither_bone_spear') {

        target.runCommandAsync('effect @s wither 5 3');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:golden_endra_plum") {
            player.runCommandAsync("function goldenendraplum")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:enchanted_golden_endra_plum") {
            player.runCommandAsync("function enchantedendraplum")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "food:ascendant_endra_plum") {
            player.runCommandAsync("function ascendantendraplum")
        }
    })


world.afterEvents.entityHurt.subscribe(({ hurtEntity: target, damageSource: { damagingEntity: attacker }}) => { 
    const itemInHand = attacker?.getComponent('equippable')?.getEquipment('Mainhand');
    if (target && attacker && itemInHand?.typeId === 'spear:shulker_spear') {

        target.runCommandAsync('effect @s levitation 8 0');
    }
});


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:nightmare_gas_bottle") {
            player.runCommandAsync("function nightmaregasbottle")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:dimensional_rift_potion") {
            player.runCommandAsync("summon mechanic:dimensional_rift")
        }
    })


world.afterEvents.itemCompleteUse.subscribe(
    (data) => {
        const player = data.source
        const item = data.itemStack
        if (item.typeId ===
            "item:nether_dimensional_rift_potion") {
            player.runCommandAsync("summon mechanic:nether_dimensional_rift")
        }
    })



world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:void_pickaxe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run kill @e[type=item,r=1.5]`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:void_hoe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run kill @e[type=item,r=1.5]`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:void_axe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run kill @e[type=item,r=1.5]`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:void_shovel") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run kill @e[type=item,r=1.5]`)
    } catch (e) { }
})


world.afterEvents.playerBreakBlock.subscribe((e) => {
    try {
        if (e.itemStackBeforeBreak.typeId != "tool:heros_pickaxe") return
        const block = e.block
        const dimension = block.dimension
        dimension.runCommand(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run summon xp_orb`)
    } catch (e) { }
})
