Skip to content

Commit 65b9c0f

Browse files
authored
Merge pull request #23 from zmanowar/old-profile-lastspawned-fix
Returns Instant.now instead of null when old profiles are used
2 parents e639b67 + 4a9188a commit 65b9c0f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/randomEventAnalytics/RandomEventAnalyticsPlugin.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ private Instant getLastRandomSpawnInstant()
211211
RandomEventRecord record = localStorage.getMostRecentRandom();
212212
if (record.spawnedTime < 0)
213213
{
214-
return null;
214+
// This assumes the profile failed to load. eg. malformed data, old profile that never had a random spawn, etc.
215+
// we'll reset the timer.
216+
return Instant.now();
215217
}
216218

217219
return Instant.ofEpochMilli(record.spawnedTime);

0 commit comments

Comments
 (0)