I'm making an RPG plugin and have been trying to implement mana regeneration. I'm trying to make a number 20/20 and everytime a spell is cast, a certain amount is removed from the 20 and over time the number regenerates back up to 20. I'm storing the player's current mana level in a config named Current-Mana and the max mana as Max-Mana. The removing numbers is pretty self explanatory but the regeneration part, not so much. How do I constantly check if the current mana is less than the max-mana and if it is regenerate it?
And if lower then the config value of max mana then add a certain amount that you like you can even make it an option for in the config but if the regeneration wil add like 2 evey minute but the max is 20 then check after that if its not higher than the max so yes then set it to the maximum value