#Scheduling in PlayerEvents.loggedIn is executed instantly without waiting the specified time

4 messages · Page 1 of 1 (latest)

craggy scaffold
#

I have a script, that on login sends a request to client and waits for a request. I wanted to add a wait time on the server which would see if the message got received, but the timeout set through Utils.server.schedule(10000, e=>{ <check if message got received> }) is executed instantly, before the network event has time to occur.
Is there any way to force the schedule or a better way to check if the message got replied to by a client script before person is allowed to play?

loud hawkBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

gaunt fjord
#

I don't know if this is a fabric problem but I have exactly the same thing. None of the schedule events seem to work in PlayerEvents.loggedIn or even ServerEvents.loaded (scheduleInTicks, schedule, scheduleRepeating). Only scheduleRepeatingInTicks works for me. Maybe there will be an answer from someone who has more knowledge (that wasn't the case for me =P), but until then I have a workaround that works for me. js //SCHEDULE WORKAROUND let countServerSchedule = 0; ServerEvents.loaded((event) => { event.server.scheduleRepeatingInTicks(100, (cb) => { if (countServerSchedule > 0) { console.log('DEBUG LOADED AFTER 5 SEC'); event.server.runCommand(`say DEBUG LOADED AFTER 5 SEC`); cb.clear(); } countServerSchedule++; }); }); If you change it for PlayerEvents it could work there too. You just have to reset the counter.

nocturne gyro
#

Encountering the same issue the first time attempt to do a schedule. I did this.

ServerEvents.loaded(e => {
  e.server.scheduleInTicks(1, () => {})
})