diff --git a/packages/lib/plugin.js b/packages/lib/plugin.js index 23499e4b..162794d4 100644 --- a/packages/lib/plugin.js +++ b/packages/lib/plugin.js @@ -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) { } diff --git a/packages/slave/src/Instance.js b/packages/slave/src/Instance.js index 1fa1543c..58f15554 100644 --- a/packages/slave/src/Instance.js +++ b/packages/slave/src/Instance.js @@ -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}`)); }