1.8.8 Countdown with doubles.

Discussion in 'Spigot Plugin Development' started by TxmyDevelopment, Jan 18, 2020.

  1. Hi everybody, I'm thinking of making a countdown with a double, to get the decimals in the scoreboard, but i can't think in a way to do it. I thought reducing the period of the schedule, but i don't really think that would work, any ideas?

    thanks in advance.
  2. What do mean by „countdown with a double“?
    In Spigot, there is only one way to realize a countdown; and that is using the scheduler. The minimal period is one tick. One tick is 1/20th of a second, or 0.05 seconds. Here‘s your double :p.
    But again, what exactly are you looking for? A better resolution than the 5 ms?
  3. You can also use the system's current time in milliseconds or dates to get a more accurate polling of time left. But then again you would still have to use a scheduler at the lowest rate of 1 tick to poll the amount of time left.
  4. You can use new Thread and make it sleep for a given period.
    Code (Text):
     Thread(() -> {
       if(atomicDouble.get() == 0.0) break;