You definitely need to be doing this on the server, not the client.
AFAIK there is no oxygen used event, so you will have to use a tick event. I would suggest using a capability to store the previous air level, and comparing it each tick.
Looking at LivingEntity#increaseAirSupply and LivingEntity#decreaseAirSupply you can see exactly how the air supply is replenished, the actual replenishing or losing is done in LivingEntity#baseTick.
Entity#setAirSupply is public, so you can set that to whatever you wish in order to update the vanilla bubbles rendering. Remember to check for the maxAirSupply, and if applicable the enchantments/effects on the player.