Skip to content

2.0.0

Choose a tag to compare

@MedveMarci MedveMarci released this 01 Apr 18:44
· 6 commits to main since this release
f5f3600

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.cs has been removed and replaced by three separate components: IStatsProvider, StatsRepository, and PlayerStats
  • GetOrCreatePlayerStats() has been replaced by TryGetOrCreatePlayerStats()
  • GetStat.cs, GetLeaderboard.cs, and ModifyStat.cs command files have been replaced by GetStatCommand.cs, LeaderboardCommand.cs, and ModifyStatCommand.cs
  • Config keys have changed — regenerate your config.yml after upgrading

Added

  • IStatsProvider interface — clean public API contract for all stat operations; other plugins can now depend on the interface instead of the implementation
  • IStorageProvider interface — pluggable storage backend; storage is now fully separated from stat logic
  • JsonStorageProvider — replaces the old inline JSON logic; uses temp-file writes
  • BinaryStorageProvider — 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 days
  • LastDays config option — define which day windows (e.g. 7, 30, 90) are shown in .getstat and leaderboards
  • AdminStatsCommand (ss) — new admin command group with subcommands:
    • ss save — force save to disk
    • ss reload — reload from disk
    • ss resetplayer <userId> — delete all stats for a player
    • ss migrate — repair v1 counter inconsistencies
    • ss info — show system status
  • ModifyStatCommand — new addstat, removestat, setstat, deletestat commands for admin stat editing
  • V1Migrator — migrates the V1 files to V2
  • StorageProvider config option — choose between Json and Binary storage; swappable at runtime
  • AutoSaveIntervalSeconds config option — configurable auto-save interval (minimum 10 seconds)
  • Auto-save coroutine — stats are saved in the background automatically, no longer only on shutdown

Changed

  • PlayerExtension methods fully reworked to match the new API; all methods now have both Player and string userId overloads
  • Leaderboard command now detects stat type (counter vs duration) automatically and supports last <days> filtering
  • .getstat now 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 OnQuit handler now ensure stats are always saved
  • Leaderboard and .getstat could show correct playtime for online players
  • Various null reference errors in commands when players had no stats yet