Regeneration effect doesn't work while in lava

Hi, I’m developing a plugin that gives me and my friends special powers. So far, this plugin negates all incoming fire damage and gives me regeneration when I’m on fire, in lava, standing on magma blocks etc.
However, it seems that whenever I stand in lava or fire, the regeneration potion effect is applied but doesn’t seem to allow me to regenerate health. I’m not taking damage but I also don’t gain any health. As soon as I step out of the fire/lava I start gaining health, but standing in it doesn’t seem to work. Here’s the code:

@EventHandler
public void OnEntityDamageByFire(EntityDamageEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Player && entity.getName().equals("EzraFlamestriker")) {
        Player p = (Player) entity;
        switch (event.getCause()) {
            case HOT_FLOOR:
                p.addPotionEffect(PotionEffectType.REGENERATION.createEffect(20, 0));
                event.setCancelled(true);
                break;
            case FIRE_TICK:
                p.addPotionEffect(PotionEffectType.REGENERATION.createEffect(30, 1));
                event.setCancelled(true);
                break;
            case FIRE:
                p.addPotionEffect(PotionEffectType.REGENERATION.createEffect(20, 2));
                event.setCancelled(true);
                break;
            case LAVA:
                p.addPotionEffect(PotionEffectType.REGENERATION.createEffect(20, 3));
                event.setCancelled(true);
                break;
            case LIGHTNING:
                p.removePotionEffect(PotionEffectType.BLINDNESS);
                p.removePotionEffect(PotionEffectType.CONFUSION);
                p.removePotionEffect(PotionEffectType.POISON);
                p.removePotionEffect(PotionEffectType.WITHER);
                p.removePotionEffect(PotionEffectType.HUNGER);
                p.removePotionEffect(PotionEffectType.SLOW);
                p.removePotionEffect(PotionEffectType.SLOW_DIGGING);
                p.removePotionEffect(PotionEffectType.UNLUCK);
                p.removePotionEffect(PotionEffectType.WEAKNESS);
                p.addPotionEffect(PotionEffectType.REGENERATION.createEffect(400, 7));
                p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(400, 9));
                p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(200, 5));
                p.addPotionEffect(PotionEffectType.GLOWING.createEffect(200, 0));
                event.setCancelled(true);
                break;
        }
    }
}