SyncScheduledTasks setting time breaks psychics? [Resolved]

Discussion in 'Plugin Development' started by Deathmarine, Jul 17, 2012.

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

    Deathmarine

    I set an infinite time loop that I'm using to keep the time constant in game. However on a sync'd thread it causes the server to lose game psychics. Almost like a freeze time. I tried to push the time out but I'm throwing modification exceptions whether sync'd or async.
    Main thread.

    Code:
    public void onEnable(){
    World world = this.getServer().getWorld("world");
    this.getServer().getScheduler().scheduleSyncRepeatingTask(this,new TimeRunnable(world), 0, 1L);
    }
    
    Code:
    import org.bukkit.World;
     
    public class TimeRunnable implements Runnable{
    World night;
    public TimeRunnable(World world){
    night = world;
    }
    @Override
    public void run() {
    night.setFullTime(18000);
    }
     
    }
    
    I like that the sky doesn't glitch but does anyone know of another way to not "ruin" pyschics. (Gravel and Sand will not fall and Water and Lava will not spread.)
     
  2. Offline

    andf54

    From javadoc: Note that this sets the full time of the world, which may cause adverse effects such as breaking redstone clocks and any scheduled events

    Try using .setTime(time) instead.

     
    Deathmarine likes this.
  3. Offline

    Deathmarine

    Interesting. I'll set this up now.

    Works like a charm. I never really looked into it that deep. Marked Resolved.
     
Thread Status:
Not open for further replies.

Share This Page