Convert Ticks into Minutes/Seconds?

Discussion in 'Plugin Development' started by MattexFilms, Sep 20, 2012.

  1. Offline

    MattexFilms

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    How would you convert ticks into seconds or minutes?
  2. Offline

    gregthegeek

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm pretty sure that 20 ticks = 1 second.
  3. Offline

    MattexFilms

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Okay thanks, I'll see what I can do with that.
  4. Offline

    makskay

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @MattexFilms You can't always assume that 20 ticks == 1 second, because the server can slow down and end up processing fewer ticks per second due to heavy load. For most implementations it doesn't really matter, but if a server is running your plugin and is operating at only 10 ticks per second, every tick-based countdown and the like will take twice as long to elapse.

    This post has been edited 1 time. It was last edited by makskay Sep 20, 2012.
  5. Offline

    MattexFilms

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Ohh right, cause I am doing something where players can see how long they have been alive. I'm using .getTicksLived() and I wanted to convert the ticks into a unit of time.
  6. Offline

    -_Husky_- BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    It should adapt to the servers ticks per second automatically, as its counting the players ticks serverside, not assuming anything. At least, thats what i would think

Share This Page