Skip to content

Network Sync and SQL

mcgaming251-eng edited this page Nov 26, 2026 · 3 revisions

Network Sync and PostgreSQL

4.0 optional feature · Fabric and NeoForge · Minecraft 1.21.1

Connect multiple dedicated Minecraft servers to one PostgreSQL database to share CobbleGacha banks and selected settings/progress. A Velocity plugin is not required. A proxy can route players, but CobbleGacha servers communicate through PostgreSQL. Use matching mod versions and consistent player UUIDs on every server.

In-game status showing all eleven categories

Where to configure it

Start the updated dedicated server once. It generates config/cobblegacha/network-sync.json. Stop the server, edit that file, then restart. Web settings are separate in server-admin.properties.

From Preview 12, the JSON includes a _help reference block describing every field and category. The actual settings are below it. Editing an example inside _help does not enable it: copy the desired category names into the real settingsToSync array. Existing values are preserved when the help block is added.

Download the full default JSON with inline help

Complete example: share everything

This example omits _help for readability. Replace the database details with yours. The password is supplied through the server environment, not in JSON.

{
  "postgresqlEnabled": true,
  "host": "database.example.net",
  "port": 5432,
  "database": "cobblegacha",
  "username": "cobblegacha",
  "network": "main",
  "tlsMode": "verify-full",
  "importLegacyWallets": false,
  "seedSettings": false,
  "settingsToSync": [
    "shop",
    "auto-shop",
    "quests",
    "quest-progress",
    "pity-history",
    "banners",
    "backgrounds",
    "prism",
    "chest-loot",
    "player-stats",
    "rankings"
  ]
}

host and port identify the database, not the Minecraft server. On separate machines, 127.0.0.1 points to each machine itself; use the address of your shared database. A single-machine test can use localhost, a separate database port and tlsMode: "disable". For a remote production database, use verify-full with a trusted certificate matching its hostname.

JSON uses double quotes, commas between entries, lowercase true/false, and no comma after the last entry. Do not add // comments. The _help object supplies explanations while keeping the file valid JSON.

Available categories

With PostgreSQL enabled, bank balances, purchase/claim records and Prism usage counts use SQL even if settingsToSync is empty. These categories add shared settings or player progress:

Exact name Shared information
shop Custom shop offers.
auto-shop Automatic offers, wish prices, caps, shared wish budgets and refresh cycles.
quests Quest definitions, schedules, rewards/budgets and reset epochs.
quest-progress Each player's daily, weekly, monthly and event objective progress. Also enable quests.
pity-history Global/Wish Type pity, thresholds, 50/50 guarantees, wish mode and retained pull history.
banners Banner pools, availability, schedules, rotation and saved schedule presets, wish type, animation and artwork framing. See Banner Schedule.
backgrounds Uploaded background images and their catalog. Enable alongside banners when using uploads.
prism Potential Prism prices, stock, IV settings and usage rules.
chest-loot Chest loot rules; each server resolves the rules against its own installed mods and loot tables.
player-stats Known player names and observed luck statistics.
rankings Whether the public leaderboard is enabled.

For wallets only, use "settingsToSync": []. For quests and their progress, use "settingsToSync": ["quests", "quest-progress"]. Keep the same progress categories enabled wherever a player should continue the same progress.

First-time setup

  1. Back up every world, config/cobblegacha/, and the database. Choose one primary server as the source of existing data.
  2. Create the PostgreSQL database and a dedicated role allowed to create/use the mod's tables. Install the official PostgreSQL JDBC driver as config/cobblegacha/postgresql-jdbc.jar on each server.
  3. Set COBBLEGACHA_POSTGRES_PASSWORD in the environment used to launch each server. Configure the same database and network name on all participating servers. A different network name isolates records within that database.
  4. On the primary, select categories and set seedSettings: true to initialize missing shared settings/progress. Set importLegacyWallets: true only if importing its existing local wallets. Start this server first and check its status/logs.
  5. After success, set both one-time flags back to false. Start the other servers with those flags false and the desired categories selected. Existing database records are preserved; separate servers' old balances/progress are not added together.
  6. Check Banner Editor → Sync Status on each server. Bank wishes and make quest progress on one, disconnect, then join the other to verify the same bank/progress. Inspect pity/history too.

If two old servers already have different balances for the same players, reconcile them before import. Do not import all old worlds indiscriminately. Inventories and worlds remain separate; this feature does not transfer carried items or Pokémon storage between servers.

Checking sync status

Opening and refreshing Sync Status in Minecraft

Open Sync Status in the Banner Editor toolbar. The window lists PostgreSQL enabled, settings sync enabled, selected categories and each category's last successful check. Refresh requests a new snapshot; Close returns to the editor.

The web admin panel has the same status window, with full dates/times and a scrollable category list.

Web sync status

Configuration changes normally reach other servers within a few seconds. Player progress is read when used. Conflicting editor saves are rejected; reopen the editor and review the latest values. Overlapping player operations are locked to prevent concurrent changes.

Troubleshooting

Symptom Check
Missing postgresql-jdbc.jar Put the driver in config/cobblegacha/ on each server; the mod JAR is not the JDBC driver.
Password environment error Set COBBLEGACHA_POSTGRES_PASSWORD in the process that starts Minecraft.
Different data on two servers Check the database, network, selected categories and player UUIDs match.
Quest progress will not enable Add quests alongside quest-progress.
Uploaded artwork absent Enable backgrounds as well as sharing banner definitions.
Unknown category Copy its exact name from _help.availableCategories; examples are not wildcard selectors.
Database unavailable Check database reachability, credentials and TLS. Last loaded settings remain active; shared changes fail until the connection returns. Refresh after recovery.

Stop servers before changing storage mode or network names. Switching back to file storage uses local copies, which can be older than SQL. Export/reconcile first. Original banner/pity config files are saved under config/cobblegacha/local-before-sync while shared versions are active.

Back up the whole PostgreSQL database, including shared documents and backgrounds, as well as worlds/config. Test a restore before relying on it for production.

About the media

Captured from the working Fabric test setup on 13 November 2026. The in-game GIF is a short sequence of real screenshots showing editor → status → refreshed status → editor; it is a navigation guide rather than a continuous video. Minecraft's own screenshots exclude the OS cursor and computer-control glow. Values and times are test examples. The web captures use an empty example search to avoid publishing player records.

Clone this wiki locally