mySQL Integration - #39
Merged
zachduda merged 2 commits intoSep 5, 2026
Merged
Conversation
Player data can now be mirrored into MySQL (or MariaDB) as well as saved to
file, switched on under MySQL in the config.yml. The .yml files stay the
source of truth: every API read still comes off disk, so turning this on
can't slow a get down or fail because the database is busy. Each write is
copied up afterwards from a single background thread instead.
One table per plugin, which is what makes the layout legible from outside:
puuids_players one row per player - name, IP, last on, play time
puuids_plugins which table belongs to which plugin
puuids_data_<plugin> one row per stored value: uuid, path, value
Values are stored as a one-key YAML document, so types survive the round
trip - an int stays an int, a list stays a list, and ItemStacks come back as
themselves.
Writes are queued and coalesced before they are sent, so a player earning
points ten times in a flush window is one row rather than ten statements,
and what is left goes out in JDBC batches. If the database disappears the
changes wait in memory and drain when it returns; only a queue past
Max-Queued-Writes drops anything, and the files are still intact to export
from. Clearing a value removes its nested children too, with LIKE patterns
escaped so a path containing an underscore can't take a sibling's rows with
it.
Also adds /puuids mysql for status, export (push the folder up), import
(pull it down, behind a confirm) and reconnect, plus Import-On-Startup,
Export-On-Startup and Sync-On-Join for network setups - a join refresh keeps
whichever record is newer, so a player hopping back doesn't lose time.
Fixes found while reading through the rest:
- The server id was written to a top-level UUID key but read back from
Advanced.UUID, so getServerId() always answered "0" and a new id was
generated on every start-up.
- Settings.File-Cleanup.Max-Days was read without a default, so a missing or
mistyped key meant 0 days - deleting every data file on the next start.
- Allow-Unsafe-Reloads was only ever set to true, so turning it back off and
reloading left unsafe reloads permitted until the next restart.
- A file created by plugin data alone had no UUID key, which the start-up
scan then treated as corrupt and deleted.
- Leftover .tmp files from an interrupted save were reported as unknown
files and left in place; they are cleaned up now.
- The connected-plugins list named the last plugin twice and left a trailing
separator.
- /ontime cooldowns were never dropped for players who left.
- plugin.yml carried a hardcoded 4.0.0 against a 4.0.1 pom, which the update
checker then read as being out of date; it uses ${project.version} now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LCicgjWrvrV7ffqrZi7VLS
/puuids reset writes files directly rather than going through the save queue, so the mirror never saw it: the database kept the play time and plugin data that had just been erased, and Import-On-Startup or Sync-On-Join would have handed all of it straight back. "reset ontime" now mirrors the zeroed play time as it goes, and "reset all" clears the same players out of every plugin table - after flushing whatever was still queued for them, so nothing lands behind the delete. Both also save through the same atomic write the rest of the plugin uses, instead of config.save() with an empty catch block that hid the failure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LCicgjWrvrV7ffqrZi7VLS
zachduda
deleted the
claude/minecraft-plugin-mysql-integration-j8bwpb
branch
September 5, 2026 16:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.