PlayerEvents.tick(event => {
    const { player, level } = event;

    if (level.time % 20 !== 0 || !player.isAlive()) return;

    if (player.exhaustion > 0) {
        player.exhaustion *= 0.75;
    }

    if (player.health < player.maxHealth) {
        if (player.persistentData.allowHealAt && level.time < player.persistentData.allowHealAt) return;

        let food = player.foodLevel;
        
        if (food >= 14 && level.time % 200 === 0) {
            player.heal(2.0);
        } 
        else if (food >= 6 && level.time % 400 === 0) {
            player.heal(1.0);
        }
    }
});