How to do something at a specific in-game time?

Discussion in 'Plugin Development' started by ludo0777, Mar 9, 2012.

Thread Status:
Not open for further replies.
  1. I need my plugin to check the time every tick etc and if the time is 16000 it does something and if the time is 18000 it does something else. How would I go about doing this?
     
  2. If you have a Player "p":

    p.getWorld().getTime();
     
  3. No I need it to check automatically without an event.
     
  4. Then use. Bukkit.getServer().getWorld("NAME").getTime();
     
  5. Offline

    theaxeman

    getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    public void run() {
    // Check if nighttime or daytime
    if (Bukkit.getWorld("WorldName").getTime() >= 14000) NightTime = true; else NightTime = false;
    }}, 20L, 20L);
     
  6. Offline

    Taco

    There's no time change event, so the above method of using a syncRepeatingTask is probably the best way of going about it.
     
Thread Status:
Not open for further replies.

Share This Page