mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 07:33:12 +09:00
Provide reason for player leaving
Expose the reason for why a player is leaving a server in playerEvent.
This commit is contained in:
1 parent
8017497bdd
commit
db562ce6a0
5 files changed
+37
-10
No files matched your search
@@ -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" },
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -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) { }
|
||||
|
||||
|
||||
Reference in new issue
Block a user