Provide reason for player leaving

Expose the reason for why a player is leaving a server in playerEvent.
This commit is contained in:
Hornwitser committed 2022-07-08 01:00:54 +02:00
1 parent 8017497bdd
commit db562ce6a0
5 files changed
+37 -10

No files matched your search

+2
View File
@@ -1284,10 +1284,12 @@ messages.playerEvent = new Event({
type: "player_event",
links: ["instance-slave", "slave-master"],
forwardTo: "master",
eventRequired: ["instance_id", "type", "name"],
eventProperties: {
"instance_id": { type: "integer" },
"type": { type: "string", enum: ["join", "leave"] },
"name": { type: "string" },
"reason": { type: "string" },
},
});
+6
View File
@@ -208,6 +208,9 @@ class BaseInstancePlugin {
* @param {Object} event - Information about the event.
* @param {string} event.type - Either "join" or "leave".
* @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.
*/
async onPlayerEvent(event) { }
@@ -500,6 +503,9 @@ class BaseMasterPlugin {
* @param {Object} event - Information about the event.
* @param {string} event.type - Either "join" or "leave".
* @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.
*/
async onPlayerEvent(instance, event) { }