Summary
Add MariaDB/MySQL and PostgreSQL storage backends as alternatives to the current JSON file storage, targeting larger servers where file I/O becomes a bottleneck. Include a storage abstraction layer and a smart migration system for converting data between backends.
Features
Storage Abstraction Layer
- Common
StorageProvider interface used by all managers
- Implementations:
JsonStorageProvider (current), MySQLStorageProvider, PostgreSQLStorageProvider
- All managers interact through the abstraction — no direct file I/O
Database Backends
- MariaDB/MySQL support
- PostgreSQL support
- Connection pooling via HikariCP
- Prepared statements for all queries
- Proper schema with indexes for common lookups (player UUID, faction ID, chunk coordinates)
Configuration
{
"storage": {
"type": "json",
"database": {
"host": "localhost",
"port": 3306,
"database": "hyperfactions",
"username": "root",
"password": "",
"pool-size": 10
}
}
}
Smart Migration
/f admin migrate <from> <to> — Migrate data between backends (e.g., json mysql)
- Pre-migration backup (automatic)
- Progress reporting during migration
- Validation after migration (record count comparison)
- Rollback capability if migration fails
What Gets Migrated
- Faction data (all fields)
- Player data (memberships, power, profiles)
- Claim data (territory ownership)
- Relations (ally/enemy/neutral)
- Economy data (balances, transaction history)
- Zone data (safezones, warzones)
- Backup metadata
Design Principles
- JSON remains the default — zero-config for small servers
- Database backends are optional — no required dependencies
- HikariCP and database drivers loaded only when configured
- All operations remain async (CompletableFuture)
Origin
New feature for large server scalability. Not from original roadmap.
Summary
Add MariaDB/MySQL and PostgreSQL storage backends as alternatives to the current JSON file storage, targeting larger servers where file I/O becomes a bottleneck. Include a storage abstraction layer and a smart migration system for converting data between backends.
Features
Storage Abstraction Layer
StorageProviderinterface used by all managersJsonStorageProvider(current),MySQLStorageProvider,PostgreSQLStorageProviderDatabase Backends
Configuration
{ "storage": { "type": "json", "database": { "host": "localhost", "port": 3306, "database": "hyperfactions", "username": "root", "password": "", "pool-size": 10 } } }Smart Migration
/f admin migrate <from> <to>— Migrate data between backends (e.g.,json mysql)What Gets Migrated
Design Principles
Origin
New feature for large server scalability. Not from original roadmap.