Add player stat collection with pluggable YAML/MySQL storage
CI / build (push) Successful in 1m58s

Tracks races played, wins, total laps, and best times per player and
per race, recorded off the main thread after each finish. Backed by
a StatsStorage interface with two implementations: the default
YamlStatsStorage (stats.yml, zero setup) and MySqlStatsStorage
(HikariCP-pooled, auto-creates its tables, configured via
config.yml). MySQL init failures fall back to YAML rather than
blocking plugin startup. Adds /boatparty stats and /boatparty top
commands. Bundles and relocates HikariCP + MySQL Connector/J via
shadow (bumped to 9.0.2, the prior 8.3.5 couldn't shade Java 25
class files).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Michael Burgess
2026-08-08 09:00:13 -04:00
co-authored by Claude Sonnet 5
parent d6f1f53681
commit b56d4b064b
12 changed files with 581 additions and 11 deletions
+31 -2
View File
@@ -25,6 +25,8 @@ fastest lap times over a configurable number of laps.
| `/bp join <name>` / `/bp leave` | Join or leave a race |
| `/bp start <name>` / `/bp stop <name>` | Force-start or stop a race (admin) |
| `/bp list` / `/bp info <name>` | List races / show race details |
| `/bp stats [player]` | Show races played, wins, total laps, and best time |
| `/bp top <name> [limit]` | Leaderboard of best times for a race (default top 10) |
The last checkpoint added also serves as the finish line — crossing it completes a lap.
@@ -33,15 +35,42 @@ The last checkpoint added also serves as the finish line — crossing it complet
- `boatparty.admin` (default: op) — configure and control races
- `boatparty.play` (default: true) — join and play races
## Stat storage
Every race finish records the player's placement, laps, and time. Storage is
configured in `config.yml`:
```yaml
storage:
type: yaml # or "mysql"
mysql:
host: localhost
port: 3306
database: boatparty
username: root
password: ""
use-ssl: false
table-prefix: "boatparty_"
```
`yaml` (default) writes to `stats.yml` in the plugin's data folder — no setup required.
`mysql` pools connections via HikariCP and creates its `players` and `race_times` tables
automatically on first startup. All stat reads/writes happen off the main thread. If the
MySQL connection fails to initialize, the plugin logs an error and falls back to YAML
storage rather than failing to start.
## Building
```
./gradlew build
```
The compiled plugin jar is produced at `build/libs/BoatParty-<version>.jar`.
The compiled plugin jar is produced at `build/libs/BoatParty-<version>.jar`. It bundles
and relocates HikariCP and the MySQL Connector/J driver, so no extra dependency jars are
needed on the server.
## Requirements
- Java 21+
- Java 21+ to run Gradle; the plugin itself compiles against and targets Java 25
(required by the Paper 26.2 API)
- PaperMC (latest, built against Paper API 26.2)