import { world, system, GameMode, EntityDamageCause } from "@minecraft/server";
world.afterEvents.entityHurt.subscribe(event => {
    const { hurtEntity, damageSource } = event;

    if (hurtEntity.typeId === "minecraft:player") {

        if (damageSource.cause === EntityDamageCause.void) {
            hurtEntity.setDynamicProperty("void_damage_received", true);
        }
    }
});