Package valorless.rarespawns.utils
Class TimeOfDayUtils
java.lang.Object
valorless.rarespawns.utils.TimeOfDayUtils
Utility to check whether a world/time-of-day falls into a named or custom range.
- Works with a raw tick time (long time) in 0..23999 (will be normalized mod 24000).
- Supports named ranges: SUNRISE, DAY, SUNSET, NIGHT (case-insensitive).
- Supports custom ranges expressed as "start-end", for example "0-18000".
If start invalid input: '<'= end the range is start..end inclusive.
If start > end the range wraps around midnight and means start..23999 OR 0..end.
Example defaults used here:
- SUNRISE: 23000-1000 (wraps: late night -> early morning)
- DAY: 1000-12000
- SUNSET: 12000-13000
- NIGHT: 13000-23000
Adjust the namedRanges map if you want different defaults.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisTimeOfDay(long time, String rangeOrName) Check whether the given tick time is inside the provided range or named period.
-
Constructor Details
-
TimeOfDayUtils
public TimeOfDayUtils()
-
-
Method Details
-
isTimeOfDay
Check whether the given tick time is inside the provided range or named period.- Parameters:
time- world time in ticks (will be normalized mod 24000)rangeOrName- either a named range (SUNRISE, DAY, SUNSET, NIGHT) or a custom "start-end" string- Returns:
- true when time is inside the range; false if parsing fails or not in range
-