CoolDownTime to hour min and sec

Discussion in 'Spigot Plugin Development' started by dyenxunit, May 18, 2015.

  1. How do i create a cooldown timer so it displays h/m/s. I have the cool down already setup but it keeps displaying 800 sec.
  2. Inkzzz

    Resource Staff

    Put a player in a hashmap with UUID's and runnables, then run it every second and -1 every second.

    Code (Text):
    HashMap<UUID, BukkitRunnable> cooldown = new HashMap<>(UUID, BukkitRunnables);
    • Like Like x 1
  3. A cooldown is correctly implemented by storing the player and the current time in a Map. You should not be using schedulers.
    Like I said above, you should have the current time + your cooldown in milliseconds saved in a Map with the player. You can subtract the time stored in the map from the current time, divide by 1000. That will give you the seconds. You can easily find how many hours, and minutes there are with a little math.
    • Like Like x 1
  4. How do i make it display like 3:00 instead of like 3600
  5. How to use un need resources ^^
  6. I know that i cannot be spoon fed the code but i have tried multiple things to try and get this to work but i still have no luck can someone please help out with the converting 1800 seconds to make it show 30:00 mins.