Player data
Per-player values stored in YAML, SQLite or MySQL, loaded before join and saved in the background.
Docs updated · What changed
On this page
Simple per-player values: settings, counters, flags. Each player has one YAML document, stored where player-data.storage says.
ALBCore loads it before the player joins and keeps it in memory. It saves in the background on autosave, on quit and on shutdown. If loading fails, the player is refused with a message instead of being let in with empty data.
Reading and writingLink to this section
PlayerData.getInt(player, "skills.mining.level", 1)
PlayerData.getString(player, "title", "none") // also getLong/Double/Boolean/StringList/get/contains
PlayerData.set(player, "settings.mute-announcements", true)
PlayerData.set(player, "old.key", null) // removes
PlayerData.increment(player, "stats.kills") // atomic, returns the new value
PlayerData.of(player)?.keys("skills") // the PlayerDataHolder of a loaded player
// Any player, online or offline (async):
PlayerData.fetch(uuid).thenSync(plugin) { data -> show(data.getInt("level")) } // offline copy is read-only
PlayerData.edit(uuid) { data -> data.increment("pending-rewards") } // saved for offline playersSwitching storageLink to this section
- Set
player-data.storageto the new type (for examplemysql) and restart. - Run
/albcore playerdata import yaml(the old type). Offline players are copied; online players keep their current data.
If player-data.storage is a SQL type different from database.type, player data opens its own small connection pool with the same login settings.