worldStateChanged
Tells your gamemode that the clock, the weather, a world rule or the players’ marker settings changed, by your gamemode or anything else.
Renamed in 0.28 from worldChange; see renamed names.
Signature
Section titled “Signature”server.on("worldStateChanged", ({ clock, weather, rules, playerMarkers }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
clock |
{ hours: number; minutes: number; minuteStartedAtUnixMs: number } |
The clock; minuteStartedAtUnixMs is when that game minute began, in Unix milliseconds. |
weather |
number |
The weather type, 0 to 22. |
rules |
Partial<Record<WorldRuleName, boolean>> |
Every world rule and whether it’s on. |
playerMarkers |
PlayerMarkerSettings |
The players’ radar markers: { mode, radius, radarScale }; radius: null means no limit, radarScale is the game’s blip size, 1-16. |
Example
Section titled “Example”import { server } from "nativemp";
server.on("worldStateChanged", ({ playerMarkers }) => { server.log(`Markers: ${playerMarkers.mode}, radius ${playerMarkers.radius ?? "no limit"}, scale ${playerMarkers.radarScale}`);});Related
Section titled “Related”world.setClock: set the clockworld.setWeather: set the weatherworld.setRule: switch a ruleworld.getPlayerMarkerSettings: read marker settings