Show player statistics
Let players open their stats in game, and put kills, wins and leaderboards on scoreboards and holograms.
By the end of this page players can open their own statistics in game, and you can show kills, wins and a top ten on a scoreboard or a hologram. Statistics are saved automatically in the database; there is nothing to enable.
Before you start#
Leaderboards and live numbers on scoreboards need PlaceholderAPI. The in-game menu does not.
Steps#
Open your stats
Run /events stats. The menu opens on General stats: games played, wins, win rate, kills, deaths and K/D across every event.
Open one game
Click the item of a game (for example Spleef). It shows that game's record (games, wins, losses, win rate), its combat numbers when it has any, and the fastest win and best round when one was recorded.
See another player
Run /events stats <player>. It needs exyliaevents.commands.stats.others; your own stats need exyliaevents.commands.stats.
Put a leaderboard on display
In your scoreboard or hologram plugin use %exyliaevents_top_name_wins_1% and %exyliaevents_top_value_wins_1% for first place, _2 for second and so on.
Check that it works#
Finish one event, run /events stats and the game's games-played count has gone up. For the placeholders, run /papi parse me %exyliaevents_stats_wins% and you get a number.
Going further#
What is counted#
Kills, deaths, wins and games played (every event the player took part in). They are tracked three ways: for the player overall, per minigame (all arenas of Spleef together) and per event configuration, so a player's Spleef record stays apart from their TNT Run record while the overall totals keep adding up.
The menu and the %exyliaevents_stats_<type>_<stat>% placeholders read the per-minigame numbers, which also hold fastest win and best round. %exyliaevents_event_stats_<stat>_<event>% reads one configuration. See Placeholders for every key.
The plugin ranks players through placeholders; it ships no top-ten menu or command. The ranking placeholders keep the top ten: anything deeper means reading the tables yourself.
Edit the menu#
The stats menus are lang/<code>/menus/user/stats.yml and stats_type.yml, edited like the rest of the menus.
Music preference#
Separately from statistics, one preference is stored per player: whether event music is on. Players toggle it with /events music and it survives reconnects.
Tables and API
| Table | Holds |
|---|---|
events_player_stats | The global totals. |
events_player_type_stats | One row per player per minigame: kills, deaths, wins, games, fastest win, best round. |
events_player_event_stats | One row per player per configuration. |
events_player_preferences | The music switch. |
EventsAPI exposes the global totals:
int kills = EventsAPI.getPlayerKills(uuid);
int deaths = EventsAPI.getPlayerDeaths(uuid);
int wins = EventsAPI.getPlayerWins(uuid);
int games = EventsAPI.getGamesPlayed(uuid);See API. Ranking placeholders sort on kills, deaths, wins or games.
Something missing on this page? Tell us on Discord