# Tarna Minecraft Bedrock Server / Dragonfly ## Run - `go run main.go` — start server (uses `config.toml`; auto-created if missing) - `go build -o mc_server main.go && ./mc_server` — build + run - `make lint` — run `golangci-lint` with `govet`, `staticcheck`, `ineffassign`, `gocritic` - `go test ./...` — all tests (only 2 test files exist; deterministic world tests use `world.Config{Synchronous: true}`) - CI runs `make lint` then `go test ./...` on every PR/push ## Architecture - `main.go` — entry point; adds custom mob spawner (every 20s), item cleaner (every 15min), cooperative random spawn, admin-only commands (2 hardcoded admins) - `server/` — the Dragonfly library: `server.go` (core), `conf.go` (config), `session/` (network protocol), `cmd/` (command framework), `block/`, `entity/`, `world/` (world + generators + LevelDB storage) - `cmd/blockhash/` — standalone utility for block hash generation - `config.toml` — runtime config (TOML); network address, world folder, chunk radius, resource packs, etc. ## Code conventions - Module: `github.com/df-mc/dragonfly` (Go 1.26) - British English in docs, symbols, variables - `gofmt` formatting; 3+ sequential vars grouped into `var()` block - Minimize exported symbols; conservative use of generics - `eol=lf` for all `.go` files (`.gitattributes`) ## Generated files (DO NOT EDIT) - `server/session/enchantment_texts.go` — autogenerated by CI from GitHub contributor list ## Deploy (push to master only) - Builds binary → SCPs to VPS → stops old server via `screen` → starts new binary in `screen -S dragonfly` - PRs deploy test server to `df-mc.dev/pullrequest/` for review ## Data / runtime - World data stored in `world/`, player data in `players/`, resource packs in `resources/` (all gitignored) - `bans.json` for multi-factor ban system by username/XUID/UUID/IP