Cool Down!

Discussion in 'Plugin Development' started by Specops343, Jul 2, 2011.

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

    Specops343

    Any ideas how I might go about coding a cooldown plugin? Ive been looking at some other plugins with cooldowns, but have come up empty. Any ideas? ;)
     
  2. Offline

    MadMonkeyCo

    Maybe try using System.currentTimeMillis()
     
  3. Offline

    Specops343

    Mind expanding on that a little? What I'm trying to do is once you eat food, for which I'm using on playerinteract, with the material pork (better way to do this?), and then what?
     
  4. Offline

    Jaker232

    Maybe you should do the follow like what you:

    1. Do Event playerinteract with material pork
    2. Do System.currentTimeMillis() [I have no experience with this, but I'm guessing the steps you do]
    I think..
     
  5. Offline

    MadMonkeyCo

    When the player manages to eat you store the System.currentTimeMillis() in an integer. Then when he tries to eat again you check if(System.currentTimeMillis() - lastTimeAte > delayInMillis) and then you store the time again. Else you cancel the event.
    I assume that's what you are trying to do, add a delay between eating. I believe a HashMap<String, Int> would be good for storing the last time they ate. The string would then be the player's name and the integer would be the time they last ate.
     
  6. Offline

    Specops343

    Thanks, i'll give it a go.
     
Thread Status:
Not open for further replies.

Share This Page