Jump to content

Recommended Posts

Posted

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!

  • 5 months later...
Posted

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

Posted

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!

  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.