Files
Michael BurgessandClaude Sonnet 5 b56d4b064b
CI / build (push) Successful in 1m58s
Add player stat collection with pluggable YAML/MySQL storage
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]>
2026-08-08 09:00:13 -04:00

77 lines
2.7 KiB
Markdown

# BoatParty
An ice-and-boat lap racing minigame for [PaperMC](https://papermc.io/), targeting the latest
Minecraft server API (Paper 26.2).
## How it works
Build an ice track, place checkpoints along it, and race other players in boats for the
fastest lap times over a configurable number of laps.
## Commands (`/boatparty`, alias `/bp`)
| Command | Description |
|---|---|
| `/bp create <name>` | Create a new race |
| `/bp delete <name>` | Delete a race |
| `/bp setlobby <name>` | Set the waiting-area location (your current position) |
| `/bp setstart <name>` | Set the race start/grid location |
| `/bp addcheckpoint <name>` | Append a checkpoint at your current position |
| `/bp removecheckpoint <name>` | Remove the last checkpoint |
| `/bp setlaps <name> <n>` | Set number of laps |
| `/bp setminplayers <name> <n>` | Minimum players required to auto-start the countdown |
| `/bp setcountdown <name> <seconds>` | Countdown length before a race begins |
| `/bp setradius <name> <blocks>` | Checkpoint trigger radius |
| `/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.
## Permissions
- `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`. It bundles
and relocates HikariCP and the MySQL Connector/J driver, so no extra dependency jars are
needed on the server.
## Requirements
- 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)