Add persistent player stats and DB support
Introduce MySQL persistence and an in-memory stats system with async saving. - Add HikariCP & MySQL connector dependencies and relocate libs in build.gradle.kts. - Add DatabaseManager (HikariCP) to manage connection pool and lifecycle. - Add PlayerStats data model and PlayerStatsRepository for table creation, reads, upserts and batch upserts (with prepared statements). - Add StatsManager: coroutine-based cache, dirty-flags, async batch saves, auto-save (every 5 minutes), load/save APIs and shutdown save. - Add StatsListener: load on AsyncPlayerPreLoginEvent and save on PlayerQuitEvent. - Wire DB and stats into main plugin: connect on enable (disable plugin on fail), initialize StatsManager, save/disconnect on disable, register leaderboard command and stats listener. - Update GameManager to record kills/wins/deaths and adjust scrimScore on events. - Add LeaderboardCommand and language entries for leaderboard output; expose command in plugin.yml. - Add database configuration section to config.yml. - Minor refactor: KitCommand plugin accessor changed to a getter. These changes provide a robust, pooled DB connection and efficient stats persistence (batched/upserted) to reduce DB load and ensure data safety during shutdown.
This commit is contained in:
@@ -18,4 +18,16 @@ anti-runner:
|
||||
punish-time: 25
|
||||
# Einstellungen für die Cave-Erkennung
|
||||
ignore-vertical-distance: 15.0 # Wenn Höhenunterschied > 15, Timer ignorieren
|
||||
ignore-cave-surface-mix: true # Ignorieren, wenn einer Sonne hat und der andere nicht
|
||||
ignore-cave-surface-mix: true # Ignorieren, wenn einer Sonne hat und der andere nicht
|
||||
|
||||
database:
|
||||
host: "localhost"
|
||||
port: 3306
|
||||
name: "speedhg"
|
||||
username: "speedhg_user"
|
||||
password: "dein_sicheres_passwort"
|
||||
use-ssl: false # auf true setzen wenn der DB-Server ein SSL-Zertifikat hat
|
||||
|
||||
pool:
|
||||
max-size: 10 # maximale gleichzeitige Connections (für 1 Server: 5-10 reichen)
|
||||
min-idle: 2 # Mindestanzahl idle Connections im Pool
|
||||
Reference in New Issue
Block a user