Solved Cooldown with currentTimeMillis()

Discussion in 'Plugin Development' started by idkG0D, Oct 3, 2019.

  1. Offline

    idkG0D

    Basically, i've expended all my time today trying to make that works. When i try to make a cooldown with System.currentTimeMillis() it not work!

    MY CODE

    Code:
    public void onEnable(){
    
            long left = ((System.currentTimeMillis()/1000) + 60) - (System.currentTimeMillis()/1000);
    
    
            if(left > 1){
                Bukkit.getConsoleSender().sendMessage("\n\n§aTime: §b"+left);
                return;
            }
    
            if(left < 1){
                Bukkit.getConsoleSender().sendMessage("\n\n§aTime: §bComplete!");
            }
    
    }
    i maked a post in stack overflow, spigot forums and no one can help me... Please, can someone help me here?

    ah, he send just one message to my console, but i want to get messages saying woh much time will take to end this cooldown

    [​IMG]
     
    Last edited by a moderator: Oct 3, 2019
  2. Offline

    timtower Moderator Moderator

    @idkG0D It is correct though. The difference is 60.
    And you aren't sending any more things.
     

Share This Page