Cooldown

Discussion in 'BungeeCord Plugin Development' started by PapaGoofy, Feb 4, 2020.

  1. Hello, do anyone know how to add a cooldown to a bungeecord plugin like it says: You cannot use this command for another (seconds left) seconds?
     
    • Like Like x 1
  2. It's java so it's the same as bukkit, you just need to change around some things.
     
  3. The following should work:

    Code (Text):
    //Creating variable
    boolean isOnCooldown;


    //setting variable in your commands method on true and ask // if isOnCooldown is false your command should work


    new BukkitRunnable() {
      int cooldown = <seconds>;

      public void run() {
        if(cooldown <= 0) {
          isOnCooldown = false;
          cancel;
        }

        cooldown--;
      }

    }.runTaskAsyncronously(<Your Instance Method>, <Time in seconds> * 20);