mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
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:
1 parent
deb6842a4d
commit
0245ccd16c
12 files changed
+400
-34
No files matched your search
@@ -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}`));
|
||||
|
||||
Reference in new issue
Block a user