#Is there a way to detect tick time? Like, `onTick(e => if (e.time > 1000ms) {do stuff})`

26 messages · Page 1 of 1 (latest)

fresh comet
#

`

karmic patrolBOT
#

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

lusty thistle
#

doesn't level or server have tick time?

wary spindle
#

what do you mean

#

like if single tick took 1000ms?

#

aka 0.5 TPS? raha

lusty thistle
#

if you mean you want to check for it to be some amount of time before doing something, would .schedule() or .scheduleInTicks() not work?

broken acorn
#

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

fresh comet
#

i want a lag detector

#

not a lag source detector, just "there was lag"

lusty thistle
#

looks like vanilla is actual time in milliseconds - server.getNextTickTime()

#

maybe something like:

ServerEvents.tick(event => {
  if (Utils.systemTime - event.server.nextTickTime > 1000) {

  }
})
fresh comet
#

how does a tick know the time the next tick will be

lusty thistle
#

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

wary spindle
#

I would just.. not do lag detection with kube lol

#

that's why Spark exists

fresh comet
wary spindle
#

that is... a very interesting quest raha