Cooldown

Discussion in 'Plugin Development' started by Ziddia, Mar 22, 2011.

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

    Ziddia

    How would I make a cooldown function?

    If you need my code, it's on my git under Transmutr. Don't edit the code for me, just tell me how please. Also, this would need to be configurable on my Transmutr.properties file too.

    Thanks.
     
  2. Offline

    Crash

    Using the scheduler maybe or a timer. I don't know how much lag that could cause though.
     
  3. Offline

    Edward Hand

    Here's what I'd do. I'd keep a hash-table of players against time when they last used the command. Every time they use the command, check that the difference between the value in the hash table and the current time is long enough, and if so carry out the command and update the value in the hashtable

    If you have different commands with different cool-downs then you'd perhaps create a little class or something like that for storing a series of values and have a hash-table of players against chosen data structure
     
  4. Offline

    Ziddia

    OK.... so make a class called TransmutrCooldown or something and put the hash-table in that, and make it read the last time the event happened?
     
Thread Status:
Not open for further replies.

Share This Page