I made a "mod" that makes player blind if they are sprinting how
Don't know about finding if they're sprinting, but here's the relevant code for adding a potion effect to a player:
entity.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, amplifier, false, false));
entity = Whatever you named your entity at the top of the method call.
Duration and amplifier must be integers. The Boolean flags are for setting particles and "ambient" effect.
Check out my Youtube channel, where I build a theme park in vanilla Minecraft!