Solved Skipping night

Discussion in 'Plugin Development' started by qtimexdel, Nov 17, 2020.

  1. Offline

    qtimexdel

    Hey there,
    Quick question:

    Is there a good way to skip the night?
    Like when a player sleeps...?

    Currently I do this with
    world.setTime(1000);
    but is there a better way?

    And another question I have but that is not so important:
    is there a way to check if a player is in bad for like 2secounds or something?
    you know... when the screen stops getting darker and when you need to wait for others to sleep?
     
    Last edited: Nov 17, 2020
  2. Offline

    Kars

    Catch PlayerBedEnterEvent and schedule a task 40 ticks in the future.

    As for your original question: Your method works, doesn't it? The only problem is you will not see what day your server is on because it will always revert to day 1.
    You can calculate what the next morning would be, using world.getFullTime together with world.getTime, and set time to that using world.setFulTime.
    getTime returns the time of day, like 1000. Full time returns the total time.
     
  3. Offline

    qtimexdel

    okay thanks for replay :D
    so 1. That still dosnt work
    For example I want to skip the night and normaly when you skip the night phantoms wont spawn and also the rain dissapeares. And that has not worked with the method sadly...
    2. how to schedule delayed tasks?
     
  4. Offline

    Kars

  5. Offline

    qtimexdel

    Okay thats an idea :D Thank you!
    I think this issue is now solved!
     

Share This Page