world.getClock
Returns the time on the shared game clock. It runs one game minute per real second.
Renamed in 0.28 from world.clock; see renamed names.
Signature
Section titled “Signature”world.getClock(): { hours: number; minutes: number }Parameters
Section titled “Parameters”None.
Returns
Section titled “Returns”{ hours, minutes }: 0 to 23 and 0 to 59, run on from the server’s last report.
Example
Section titled “Example”import { chat, commands, world } from "nativemp";
commands.register("time", (player) => { const { hours, minutes } = world.getClock(); chat.sendServerMessage(`It's ${hours}:${String(minutes).padStart(2, "0")}.`, player);});Related
Section titled “Related”world.setClock: set itworldStateChanged: it was set