# Database & Progress System


#

Supported Database Types

# SQLite (Default)

  • File-based: plugins/PremiumAdvancements/data.db
  • No external setup required
  • Best for small to medium servers (< 50 players)
  • Uses the SQLite JDBC driver

# MySQL / MariaDB

  • External database server required
  • Uses HikariCP connection pooling
  • Best for large servers or server networks (BungeeCord/Velocity)

#

Connection Pool Settings

Setting Value
Maximum Pool Size 10
Minimum Idle 2
Connection Timeout 30000ms
Idle Timeout 600000ms
Max Lifetime 1800000ms

#

Database Tables

# player_advancements

Column Type Description
player_uuid VARCHAR(36) Player UUID (Primary Key)
advancement_id VARCHAR(255) Advancement ID (Primary Key)
completed_at TIMESTAMP When the advancement was completed

# player_progress

Column Type Description
player_uuid VARCHAR(36) Player UUID (Primary Key)
advancement_id VARCHAR(255) Advancement ID (Primary Key)
progress INT Current progress amount

#

Player Progress System

# Architecture

The progress system uses a two-layer architecture:

  1. In-memory cache (ConcurrentHashMap): Fast read/write operations during gameplay
  2. Database (SQLite/MySQL): Persistent storage for server restarts

# Auto-Save

  • Every 30 seconds, all cached progress is saved to the database asynchronously
  • On player quit: Progress is saved immediately
  • On server shutdown: All progress is force-saved synchronously

# Progress Flow

  1. Player triggers an advancement event
  2. Trigger service checks permissions, worlds, prerequisites, and existing completion
  3. If advancement requires progress (amount > 1), increment is stored in cache
  4. Cache is periodically synced to the database
  5. When progress reaches the required amount, advancement is completed
  6. All rewards are processed synchronously (commands, items, money, etc.)
  7. Discord webhook is sent asynchronously

# Real-time Updates

When an advancement is completed, the plugin re-checks all dependent/hidden advancements in real-time. If prerequisites are now met, hidden advancements are immediately revealed.