So I have a RPG themed plugin and some classes use mana, obviously in most class based system your mana will regenerate over time so I was wondering what would be the best way of doing this? Every player that uses "mana" is kept in a Hashmap<String, Integer> so would it be best to run a constant timer and idk every 5 seconds get all the player's names in the Hashmap and check their Integer if it's < 100 then add some? Except running a constant timer could use a lot of resources right? Whats the best way of doing this. This method i'd also have to check to see if the player's online so they can't gain mana when offline. Tldr; Best method to make players regenerate mana?
Mkay, would you mind taking a look at my other thread? You're pretty smart. http://forums.bukkit.org/threads/setting-wolfs-target.107539/