2.0.0
2.0.0
This release is a full rewrite of the plugin. The core stat storage and API have been redesigned from scratch. Existing player_stats.json files from v1 are compatible, but the ss migrate command should be run once after upgrading to repair any counter inconsistencies left over from v1 bugs.
Breaking Changes
StatsSystem.cshas been removed and replaced by three separate components:IStatsProvider,StatsRepository, andPlayerStatsGetOrCreatePlayerStats()has been replaced byTryGetOrCreatePlayerStats()GetStat.cs,GetLeaderboard.cs, andModifyStat.cscommand files have been replaced byGetStatCommand.cs,LeaderboardCommand.cs, andModifyStatCommand.cs- Config keys have changed — regenerate your
config.ymlafter upgrading
Added
IStatsProviderinterface — clean public API contract for all stat operations; other plugins can now depend on the interface instead of the implementationIStorageProviderinterface — pluggable storage backend; storage is now fully separated from stat logicJsonStorageProvider— replaces the old inline JSON logic; uses temp-file writesBinaryStorageProvider— new compact binary format; ~70% smaller files, faster serialization- Daily tracking — every counter and duration is now also tracked per-day automatically
GetLastDaysCounter/GetLastDaysDuration— query the sum of any stat over the last N daysLastDaysconfig option — define which day windows (e.g. 7, 30, 90) are shown in.getstatand leaderboardsAdminStatsCommand(ss) — new admin command group with subcommands:ss save— force save to diskss reload— reload from diskss resetplayer <userId>— delete all stats for a playerss migrate— repair v1 counter inconsistenciesss info— show system status
ModifyStatCommand— newaddstat,removestat,setstat,deletestatcommands for admin stat editingV1Migrator— migrates the V1 files to V2StorageProviderconfig option — choose betweenJsonandBinarystorage; swappable at runtimeAutoSaveIntervalSecondsconfig option — configurable auto-save interval (minimum 10 seconds)- Auto-save coroutine — stats are saved in the background automatically, no longer only on shutdown
Changed
PlayerExtensionmethods fully reworked to match the new API; all methods now have bothPlayerandstring userIdoverloads- Leaderboard command now detects stat type (counter vs duration) automatically and supports
last <days>filtering .getstatnow saves the current session's playtime before displaying, so the shown value is always up to date- Config is cleaner with proper descriptions and sensible defaults
Fixed
- Playtime could be lost on unexpected server shutdown — auto-save and
OnQuithandler now ensure stats are always saved - Leaderboard and
.getstatcould show correct playtime for online players - Various null reference errors in commands when players had no stats yet