Ongandu Posted April 8, 2025 Report Posted April 8, 2025 Does anyone know if there's a way to get api.PlayerData and retrieve the array of all players? I can find methods to get a single player by ID but not a method to get a list of all of them: https://apidocs.vintagestory.at/api/Vintagestory.API.Server.IPlayerDataManager.html By getting all players I mean even offline ones, not just the api.server.AllPlayers which gets a list of players that joined the server since the it's been running (a restart clears this list) Any ideas would be appreciated!
Iceball 457 Posted September 21, 2025 Report Posted September 21, 2025 It's definitely possible to save the player's object(s) to a Dictionary as they connect, and save that Dictionary to disk by wrapping it up neatly in a json serializable class. Same as you would do for regular mod configurations I wouldn't try to force the data back inside the Server API interface though, any functionality you want should probably depend on the custom implementation
Mrozak Posted September 21, 2025 Report Posted September 21, 2025 Can't you just use the info stored in Playerdata/playerdata.json ?
myenemies Posted September 21, 2025 Report Posted September 21, 2025 seconding Mrozak here; my server is not extremely large, but server\data\Playerdata\playerdata.json seems to retain all player information even after a server restart! 1
Recommended Posts