Skip to content

SQL Storage

TejasLamba2006 edited this page Jul 26, 2026 · 1 revision

SQL Storage

ChatColor3 can store player data in MySQL or MariaDB instead of YAML files.

Setup

  1. Create a database (the plugin can also auto-create it):
CREATE DATABASE chatcolor_db;
  1. Edit plugins/ChatColor3/config.yml:
storage:
  type: sql
  database:
    address: localhost
    port: 3306
    name: chatcolor_db
    user: database_user
    password: database_password
  1. Restart the server (storage type cannot be changed with /chatcolor reload).

Table Schema

The plugin auto-creates the table chatcolor_players:

CREATE TABLE chatcolor_players (
    UUID VARCHAR(255) PRIMARY KEY,
    Colour VARCHAR(255),
    DefaultCode BIGINT
);

Notes

  • The MariaDB JDBC driver and HikariCP connection pool are bundled (shaded) in the plugin jar — no external dependencies needed.
  • All database operations run asynchronously to avoid blocking the main thread.
  • Player data is cached in memory and written through on change.
  • On shutdown, any unsaved data is flushed.

Migrating from YAML

There is no automatic migration tool. To migrate:

  1. Stop the server
  2. Set storage.type to sql and configure the database
  3. Start the server (creates the table)
  4. Manually copy data from players/*.yml files into the database, or let players re-set their colours

Clone this wiki locally