[SOLVED] How to get the World Time

Hey there!

I’m simply trying to figure out how to get the current time in the world. I’m assuming it’ll be given in ticks passed since the start of the day. I tried player.getWorld().getTime(), but nothing along those lines exists.

Any help is greatly appreciated! Thanks!

Time is in the WorldProperties, not the World. You want player.getWorld().getProperties().getWorldTime() % 24000.

Thank you! I’m assuming that 24,000 is the amount of ticks per day. Would that be a correct assumption?

Yes. The total ticks in a day is 24000, but the world time is the total ticks the world has been around for, which is why you need the modulus there. Be careful to keep that in mind when setting the world time too.

Ah, I gotcha. That makes since. Thanks for the help!