How do I add a cooldown to a sub command?

Discussion in 'Plugin Development' started by dkfredebang, Apr 7, 2014.

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

    dkfredebang

    So if I wanted to add a cooldown to let's say this
    EDIT: I am very sorry to ask this but I am kinda new to making bukkit plugins and I really got stuck when I had to add a cooldown to this command.
    Code:java
    1. if (args[0].equalsIgnoreCase("heal"))
    2. if (sender instanceof Player){
    3. Player player = (Player) sender;
    4. player.setHealth(3.5);
    5. player.sendMessage(ChatColor.BLUE + "LCPvP" + ChatColor.DARK_GRAY + "> " + ChatColor.AQUA + "You have been healed!");
    6. return false;
    7. }
    8. }
    9. }
    10.  


    What would I add to it?
     
  2. Offline

    Yonas

  3. Offline

    dkfredebang

    Yonas One problem. Time.MINUTES and Time.SECONDS cannot be resolved.
     
  4. Offline

    coasterman10

    Yonas Time should be a static enum, or even better, a separate class. It has no connection to any specific CooldownManager instance.
     
  5. Offline

    Yonas

    dkfredebang I dont understand your problem. I tested it and it works fine.

    coasterman10 Okay, sorry for the mistake. :)
     
Thread Status:
Not open for further replies.

Share This Page