Share player stats with master server

Send the per player stats with the player event updates to the master
server and expose it to the Web UI and ctl interfaces.
This commit is contained in:
Hornwitser committed 2022-07-12 23:03:50 +02:00
1 parent deb6842a4d
commit 0245ccd16c
12 files changed
+400 -34

No files matched your search

+3 -1
View File
@@ -342,6 +342,7 @@ class Instance extends libLink.Link {
instance_id: this.id,
type: "join",
name,
stats: stats.toJSON(),
};
libLink.messages.playerEvent.send(this, event);
libPlugin.invokeHook(this.plugins, "onPlayerEvent", event);
@@ -363,6 +364,7 @@ class Instance extends libLink.Link {
type: "leave",
name,
reason,
stats: stats.toJSON(),
};
libLink.messages.playerEvent.send(this, event);
libPlugin.invokeHook(this.plugins, "onPlayerEvent", event);
@@ -483,7 +485,7 @@ class Instance extends libLink.Link {
pluginInstance.onExit();
}
for (let player of left) {
for (let player of this.playersOnline) {
this._recordPlayerLeave(player, "server_quit");
}
this._saveStats().catch(err => this.logger.error(`Error saving stats:\n${err.stack}`));