Detecting when the player is not using an item

The title is a bit misleading, but I couldn't find a way to summarize it any better. I am making a custom item that allows the player to float in the air using the levitation effect. It uses the food right click detection method. My problem is that when you stop right clicking, you continue to levitate for a second. I want to detect when the player was previously using the item, but isn't anymore so I can clear the effect. Is there a good way to do that?
Continue to help post