Solved Prevent time change when players are sleeping

Discussion in 'Plugin Development' started by critikull, Jun 1, 2018.

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

    critikull

  2. Offline

    MightyOne

    Whats the deal with letting sleeping skip the night. Thats what beds are made for. Just laying in a bed for 8 minutes would not be that interesting.
     
  3. Offline

    critikull

    Hi MightyOne, if you must know, Im making a minigame where players can sleep off illnesses, so id like to control how long they are in bed and not have the time change.

    that said, do you know if this is possible?
     
  4. Offline

    MightyOne

    Tag me next time.
    I do not really have an idea. Maybe you can use a BukkiRunnable to set the time every tick as soon as all players are in their beds.
     
  5. Offline

    critikull

    If anyone is curious, this is pretty easy to do. Use reflection to set sleepTicks (int) in the Player object to 0 (zero). When sleepTicks hits 100 then the time will change. Use a task to continuously reset each players sleepTicks back to zero.
     
  6. Offline

    MightyOne

    Are there getters and serter for the sleep ticks? If you can explain it well you could create a resource, you know?
     
Thread Status:
Not open for further replies.

Share This Page