Storage
What NationCrest keeps in data.yml, when it writes, and why that never costs you performance.
What is stored
plugins/NationCrest/data.yml, keyed by player account:
players:
069a79f4-44e9-4726-a5be-fca90e38aaf5:
name: Notch
country: US
override: ''
visible: true| Key | What it is |
|---|---|
name | Last known player name, so admin commands can find them by name |
country | The country that was detected |
override | A country set by hand with /flag set. Wins over country when set |
visible | Whether the player has their flag shown |
You do not need to edit this file. Everything in it has a command.
When it is written
Changes are collected in memory and written out on an interval:
storage:
flush-interval-seconds: 60Every one of those writes happens on a background thread. Nothing about saving player data touches the thread that runs your server.
A final save runs when the server shuts down. That one is on the main thread by necessity, because the background workers have already stopped by then, and the alternative is quietly losing the last minute of changes.
Why the country is stored at all
Two reasons.
It survives restarts. A returning player already has their country before the lookup finishes, so their flag is right from the first tick.
It works for offline players. Because the country sits against the account rather than only existing while the player is connected, /flag info, /flag set and /flag reset all work on somebody who is not online, and the placeholders resolve for an offline player wherever the plugin asking for them allows it.
Clearing a player
Removing an override:
/flag reset <player>That clears override and the country is detected again on their next join.
To wipe a player entirely, stop the server, delete their block from data.yml, and start it again.
Later
SQLite and MySQL storage are on the list for a later version. data.yml is the only backend in this one.