Delay Time

Discussion in 'Plugin Development' started by DevHamboy7765, Aug 28, 2016.

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

    DevHamboy7765

    Hey guys,

    If I want to make a delay in-between each use of a command, how would I do it?

    Thanks everyone,

    Hamboy
     
  2. Offline

    HeartandSoul

    So, say I was you, and I wanted the same thing:

    Make a method, and inside that method, make a runnable. At the beginning of the method, make an integer. Access that integer in a per-second runnable below it, and subtract from it. After the cooldown has reached zero, return.
     
  3. Offline

    ChucknorisSR

    HeartandSoul is a good method but can cause some lag. Another way of doing this is saving System.getCurrentTimeMillis(); in a hashmap and when the player runs the command again check the different between the time of use and the current time.
     
  4. Here's some easy made pie. You can just schedule a delay with the Bukkit scheduler.. Use a Boolean to control if the next command can be ran or not. The delay will change the Boolean.
     
  5. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page