import { world } from "@minecraft/server";


world.afterEvents.entityDie.subscribe(data => {
    const player = data.damageSource.damagingEntity
    const entity = data.deadEntity
    
    if (player?.typeId === 'minecraft:player' && player.getComponent("equippable").getEquipment("Mainhand")?.typeId === "oct_plev:demon_sword") {
		entity.runCommand("/summon oct_plev:fiery_imp");
    }
})