mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Record all players as leaving on server exit
In the case of shutdown the Factorio server will not notify the currently online players as leaving the game. Notify the master server that all remaining online players quit the game in this case.
This commit is contained in:
1 parent
ac62f66aa1
commit
deb6842a4d
2 files changed
+7
-2
No files matched your search
@@ -210,7 +210,8 @@ class BaseInstancePlugin {
|
||||
* @param {string} event.name - Name of the player that joined/left.
|
||||
* @param {string=} event.reason -
|
||||
* Only present for type "leave". Reason for player leaving the
|
||||
* game, one of the possible reasons in defines.disconnect_reason.
|
||||
* game, one of the possible reasons in defines.disconnect_reason
|
||||
* or "server_quit" if the server exits while the player is online.
|
||||
*/
|
||||
async onPlayerEvent(event) { }
|
||||
|
||||
@@ -505,7 +506,8 @@ class BaseMasterPlugin {
|
||||
* @param {string} event.name - Name of the player that joined/left.
|
||||
* @param {string=} event.reason -
|
||||
* Only present for type "leave". Reason for player leaving the
|
||||
* game, one of the possible reasons in defines.disconnect_reason.
|
||||
* game, one of the possible reasons in defines.disconnect_reason
|
||||
* or "server_quit" if the server exits while the player is online.
|
||||
*/
|
||||
async onPlayerEvent(instance, event) { }
|
||||
|
||||
|
||||
@@ -483,6 +483,9 @@ class Instance extends libLink.Link {
|
||||
pluginInstance.onExit();
|
||||
}
|
||||
|
||||
for (let player of left) {
|
||||
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