Statistics and Leaderboards
The Snake tracks six integer statistics for each player:
| Key | Meaning |
|---|---|
win | Number of won rounds. |
lose | Loss counter stored by the data model. The current game code does not increment it. |
win_streak | Consecutive wins, reset after a collision or border loss. |
best_score | Highest score reached in one round. |
total_score | Sum of all finalized round scores. |
games_played | Number of finalized rounds. |
Storage Modes
Section titled “Storage Modes”- Flat file: Stores values in
data/stats.ymlunder each player’s UUID. - MySQL: Creates or updates a table with UUID, name, and one column for every persistent statistic.
MySQL loads and saves through a single background executor. Batch saves run in a transaction and the executor is given up to 10 seconds to finish during shutdown.
Autosaving
Section titled “Autosaving”The plugin starts an asynchronous autosave task using statistic-saving-period, which defaults to 300 seconds. Each cycle saves arena data and player data, then refreshes every leaderboard. Player data is also saved when a round is cleared and during plugin shutdown.
Leaderboard Cache
Section titled “Leaderboard Cache”The plugin refreshes all persistent integer leaderboards during autosave and after an active game is cleared. Entries with values of zero are omitted, remaining entries are sorted from highest to lowest, and leaderboard-size limits the cached positions.
PlaceholderAPI exposes the cached name, UUID, or value for a requested statistic and position. See the complete placeholder reference.