I need help in fixing a function which now no longer works in 1.19.60 which is to detect the damage of an entity
world.events.entityHurt.subscribe(data => {
const attacker = data.damagingEntity, hurt = data.hurtEntity;
if (attacker.hasTag("l")) {
time++;
if (time == 1) {
attacker.runCommandAsync(`tellraw @a[tag=staff] {"rawtext":[{"text":"§7[§dCombat§7] §d${attacker.name} §7esta en pvp con§d ${hurt.nameTag} §r"}]}`);
}
if (time == 3) {
time = 0;
}
}
});