Help adding cooldown

Discussion in 'Plugin Development' started by lilladolken, Apr 4, 2014.

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

    lilladolken

    Hey! I got a kitpvp server with a custom coded kitpvp plugin coded by me and a friend. Well, I have made a kit/listener with the code: http://pastebin.com/BhVJphXW And I cant figure out how to add a cooldown.. If Anyone could please edit the code and paste it on pastebin and put a cooldown to 4 secounds and they should get a message in red text like " Please wait beforce using this item again! "
     
  2. Offline

    xMrPoi

    No one is going to spoon feed you code. That's not what we're here to do. We will however help you out.

    The way I do it is by making a method called something like "kitCooldown". It returns void and takes a player. Make an ArrayList named "cooldownList". In the method, add a task that will remove the player from the list after however long you'd like. When the person does the command, check if the list contains their name. If it does, tell them they can't use it. If they're not, then add their name to the list.
     
    Funergy likes this.
  3. Offline

    Yonas

Thread Status:
Not open for further replies.

Share This Page