Time

Discussion in 'Plugin Development' started by Black_Lottus, Jun 14, 2017.

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

    Black_Lottus

    Hi, i just start to dev a new plugin and I don't know how Synchronize the time of my server with the plugin and create several schedules that do something at such time. Could you more or less indicate how I would have to do? Thank you.

    Enviado desde mi XT1032 mediante Tapatalk
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Black_Lottus Calendar.getInstance() returns a Calendar instance ( duhh :p ) which has time, date, everything.
    How accurate do you need everything to be?
     
  3. Offline

    Zombie_Striker

    @Black_Lottus @timtower
    Also, remember that time-zones are a thing, and that you only have access to the server's time-zone and that it may not be the same as yours if you're using a hosting company.
     
    timtower likes this.
  4. Offline

    Black_Lottus

    @timtower

    For example ... That at 6:00 execute a one command. Let the 7 be restarted. At 10 o'clock another command is executed. Things like that.

    I need a quite accurate.

    Enviado desde mi XT1032 mediante Tapatalk
     
  5. Offline

    Zombie_Striker

    @Black_Lottus
    Well, if you account for time zones, it can be as accurate as you need:
    1. Create a repeating task.
    2. Every couple of ticks (or every tick if your processor can handle it) check if the time is equal to 6, 7, 10, ect.
    3. If so, execute the command/reload the server/ do what you need. (In case you don't know, use Bukkit.dispatchCommand to execute commands from the console.)
     
Thread Status:
Not open for further replies.

Share This Page