#Is there a way to detect tick time? Like, `onTick(e => if (e.time > 1000ms) {do stuff})`
26 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
doesn't level or server have tick time?
if you mean you want to check for it to be some amount of time before doing something, would .schedule() or .scheduleInTicks() not work?
use schedule on its own (it uses ms and not ticks) and check the server tick time in between
maybe
event.server.schedule(cb => {
if (event.level.time % 20 > 40) {
//stop server or whatever
} else {
cb.reschedule()
}
}, 1000)
this is probably not right but i think it gets the point across
yes
i want a lag detector
not a lag source detector, just "there was lag"
looks like vanilla is actual time in milliseconds - server.getNextTickTime()
maybe something like:
ServerEvents.tick(event => {
if (Utils.systemTime - event.server.nextTickTime > 1000) {
}
})
how does a tick know the time the next tick will be
nextticktime is the start of the tick
no idea on the naming
the "Can't keep up" msg triggers at 2s as long as it's been 15s since the last msg
ah wait, so at the beginning of the tick it adds 50ms to nextticktime
so that answers your how does it know
i want to make it so if it lags it says "hey read the spark quest"
that is... a very interesting quest 