Simple Question! (is it possible..........)

Discussion in 'Plugin Development' started by IcyRelic, Feb 5, 2012.

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

    IcyRelic

    is it possible for scheduleSyncRepeatingTask at the end when i put the time for it to repeat her is how i have it
    }, 0L, getConfig().getInt("Karma.Time.Every"));
    and it works find but is there a way for me to make the 1 in the config minutes instead of 20 ticks per second is it possible?
     
  2. Offline

    fafaffy

    I'm sorry, could you use [ code ] tags? I'm having trouble understanding the question you're trying to ask.
     
  3. Offline

    IcyRelic

    ok you know how scheduleSyncRepeatingTask runs in ticks Ex 20 ticks = 1 second
    i call my second value from the config like this
    Code:
    }, 0L, getConfig().getInt("Karma.Time.Every"));
    now lets say the Karma.Time.Every is 1200 thats 1 min
    thats the ticks the first 1 is at 0 ticks so its instant when server starts and it repeats every 1 min is there a way for me to allow the user to put 1 instead of 1200 in the config and it will do the same

    still need an answer

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
  4. Offline

    AgentME

    Just do something like this:
    Code:
    }, 0L, 1200*getConfig().getInt("Karma.Time.Every"));
     
  5. Offline

    IcyRelic

    but what if they change it to 2 mins

    still need help

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
  6. Offline

    nisovin

    You got help. Multiplying by 1200 will give you what you're looking for. This is basic math, you're converting from minutes to game ticks.
     
  7. Offline

    IcyRelic

    oh nvm lol
     
  8. Offline

    Roadkill909

    And yes it is possible. I recommend, just to be safe, if there's some code to set up your config, have it in in your onEnable method before you schedule this task, and set a default value in that config for this value. Also the code I've seen above doesn't seem to access the rich features of the new config system. You can check for section names and such.
     
Thread Status:
Not open for further replies.

Share This Page