I am making a plugin obviously and would like to check if a player has an itemstack item in their inventory and apply a potion effect. And when it is removed potion effect would go away so the potion effect has to have a short duration. I have tried many solutions and cannot find one to satisfy my requirements. I have got it to work when I right-click using an event but I can't find an event for checking the inventory. I need it to check each tick for the item and apply the effect.
Just give them the potion for infinite time, listen for when a an item is moved out of an inventory, then remove the potion effect