Having multiple cooldowns

Discussion in 'Spigot Discussion' started by Donkelyn, Apr 23, 2020.

  1. Hi, I am working on a new plugin with skills that are on cooldown. I have a single cooldown work but can't figure out how to have multiple cooldowns per player. I am using the hashmap method. The current solution I have is using multiple hashmaps, one for each different skill. Although im pretty sure there would be a better way to do this. Thanks!
  2. A simple solution would be to have a map with the key being UUID / Player and the value being a List (or ArrayList) of cooldowns (list could contain more hash maps, time vars, etc).
  3. If I'm just making more hashmaps within the list wouldn't it just be easier to create more hashmaps in the first place and call them like:
    private HashMap<UUID,Long> cooldownHeal = new HashMap<UUID,Long>();
    private HashMap<UUID,Long> cooldownFeed = new HashMap<UUID,Long>();
  4. Strahan


    I'd make a cooldown data class then store a collection of cooldown objects.
    • Agree Agree x 1