On Network Quit
Description
Fires when a player leaves the network, on the server they were last on. It runs right away, without waiting for anything.
It is a mob trigger: it runs on the mobs of that server whose type has a ~onNetworkQuit line, never on a player. The player is already gone, so the lines cannot target them or change their player variables. Skill Variables tells you who left. To run skills on every quit without a mob, use the events.network-quit list of the Paper config.
No quit fires for a player who disconnects before reaching any server. A backend can also miss a quit, see Missed Events.
This trigger requires MythicMobs Premium!
Examples
Counts the players who leave the network and remembers the last one, in global network variables that every server can read, for example with <global.netvar.leaves|0> and <global.netvar.last_leaver|nobody>. Every Gatekeeper on a server runs the lines, so spawn exactly one on each server that players can leave from, in a chunk that stays loaded:
Gatekeeper:
Type: VILLAGER
Display: 'Gatekeeper'
Options:
Despawn: false
Skills:
- networkVariableAdd{var=leaves;amount=1} ~onNetworkQuit
- networkVariableSet{var=last_leaver;type=STRING;value=<skill.var.player-name>} ~onNetworkQuit
Aliases
- onProxyQuit
- onNetwork_Quit