Just set the duration to something high (like Integer.MAX_VALUE) to approximate an infinite duration. To solve your other problem, just add an else to the if statement you already have, and use player.removePotionEffect().
You would still have to reapply the effect if it gets removed due to for example milk, as ChampionAsh pointed out.
Instead of applying every tick, I would rather subscribe to LivingEquipmentChangeEvent or whatever its called and check there and apply infinitely. Less data calculated per tick. However, you will need to check if the effect gets removed due to milk or something and reapply when that happens. However, that's my opinion.