Longer Cooldowns

Discussion in 'Plugin Development' started by Fight_Or_Die, Jul 30, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    Hey there!,

    I'm trying to get a 36 hour cooldown on the 6th use of a command. This is roughly how my project is set up:

    I'm trying to store the uses +1 each use with the max being 6 in a config.

    After the cooldown expires (36 hours) - it would then remove the uses and let them go on.

    This cooldown needs to work after reloads/restarts, too.

    Please let me know any advice :)


  2. Offline



    Well, you probably shouldn't be storing information via the player's names, for one...

    You also spelled cooldowns wrong at one point.

    You shouldn't cast the sender to a player without checking first.

    If that "cooldown" variable is a constant, it should be named in all caps with words separated by underscores. And final.

    You should really find a better way to read the config without pasting "Cooldowns.Players.whatever" all over the file. Declare some constants, use ConfigurationSections more, etc.

    Instead of multiplying by 1000, you should use TimeUnit.

    You should really have @Override annotations over your onEnable/onDisable methods.

    You keep setting a string list to "Cooldowns.Players" and then overriding that with cooldowns, which really doesn't make sense and won't work at all.

    There are probably more things, but I don't have time to write it all out.
  3. Offline


    Thanks for the reply. This is my first time storing cooldowns in this way, as you can probably tell. I've made the cooldown variable final and what is your idea of a "better way?"
  4. Offline


Thread Status:
Not open for further replies.

Share This Page