- lib/player-stats.ts: single computePlayerStats() reads every
world/stats/<uuid>.json plus world/advancements/<uuid>.json and joins
with usercache.json. Returns a flat PlayerStats record per player:
playtime, longest life, mob/player kills, deaths, K/D, damage dealt
and taken (HP-scaled), blocks mined, items used / crafted / picked up
(+ unique), distance (summed across all _one_cm stats), chest opens,
nether/end trips, villager trades, fish caught, animals bred, and
advancements (non-recipe) / recipes unlocked.
- New GET /api/players/stats (authed, 60s memo). Existing
/api/players/playtime now returns a thin projection of the same
computed data (shared cache key keeps both endpoints cheap).
- New components/Leaderboard.tsx with a metric select grouped into
Time / Combat / World / Exploration / Progression / Economy (22
metrics). Sorts descending, top 10 with "show all" toggle, smart
number formatting (1.2k / 3.4M / HP / km). Replaces the old
PlaytimeLeaderboard in the Players tab.
- PlayerDrawer upgraded: uses the full stats payload, shows small
tiles for Kills / Deaths / K/D / Advs / Mined / Crafted / Distance
alongside Playtime + Last seen.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- New GET /api/players/playtime (authed): reads each vanilla stats file
under /home/minecraft/server/world/stats and maps uuid→name via
usercache.json. Returns playtime in ticks and hours, plus file mtime
as "last seen". Memoized 60s via lib/cache#memoAsync.
- New PlaytimeLeaderboard card in the Players tab:
- Rank, avatar (click → PlayerDrawer), relative last-seen, hours.
- Top 10 by default with toggle to show all; combined hours badge.
- PlayerDrawer surfaces the player's total hours + last-seen using the
same cached playtime query, plus fills in UUID if the player is not
in ops/whitelist/banned.
- lib/time.ts: formatHours() — minutes under 1h, "H.Hh" under a day,
"Dd Hh" above.
- Analytics sparklines gain hover/touch tooltips:
- Timestamps threaded through from each MetricEntry.
- SVG overlay captures onMouseMove/onTouchMove, computes nearest
index by x, draws a dashed guide line + focus dot.
- Floating tooltip shows HH:MM + formatted value with unit; edge
clamping keeps it in-frame at the extremes.
- Per-chart formatValue so RAM shows GB, CPU 0 decimals, Players
integer, TPS 1 decimal. Keeps the peak-player marker intact.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Snapshots now include recursive sizeBytes (lib/snapshots.ts dirSize),
rendered as a badge next to mod count.
- Snapshot restore/delete is now type-to-confirm: click Restore/Delete,
type the literal snapshot name, press Enter or click Confirm. Esc
cancels, matches the existing wizard Esc handler.
- Analytics card:
- Uptime ring showing % of datapoints with tps>0 (color-graded
green/amber/red) + numeric % over selected range.
- Peak-player marker dot on the Players sparkline + peak caption.
- "Online now" player list (up to 8) with small PlayerAvatar badges,
sourced from the latest analytics entry's players[] array.
- Player profile drawer (new):
- Slide-in right panel opened by clicking any PlayerAvatar.
- Shows Online / Op / Whitelisted / Banned badges, UUID, ban reason.
- Quick toggles for op/deop, whitelist add/remove, ban (with reason
input) and pardon — reuses /api/players POST contract.
- Global event bus (lib/events.ts) decouples avatars from drawer.
- Esc / backdrop / close-button dismiss.
- PlayerAvatar now renders as a <button> by default (stopPropagation on
click, focus-visible ring); pass interactive={false} to opt out (used
inside the drawer itself).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>