Triggers
MythicProxy adds four triggers to MythicMobs. They fire when a player joins the network, moves to another server or leaves the network, and when a signal arrives.
These triggers require MythicMobs Premium!
| Trigger | Fires when | Runs on |
|---|---|---|
| onNetworkJoin | A player joins the network | The player |
| onServerSwitch | A player moves to another server | The player |
| onNetworkQuit | A player leaves the network | Mobs |
| onNetworkSignal | A signal arrives | The player or mobs, depending on the signal |
Using Triggers
Add the trigger to a skill line with ~ in front, as with any MythicMobs trigger, for example ~onNetworkQuit.
- Letter case does not matter.
- Put the line in the
Skillsof a mob type or, for a player trigger, of a MythicCrucible item. Inside a metaskill, MythicMobs ignores the trigger.
Mob Triggers and Player Triggers
Mob Triggers
~onNetworkQuit, and ~onNetworkSignal for a signal sent to every server or to one server, run on mobs. On each server that receives the event, every MythicMobs mob whose type has a line with the trigger runs that line, in any world and at any distance.
- The mob is the caster, so
@selfis the mob. There is no@trigger: read who left or what arrived from the skill variables. - Only mobs in loaded chunks react. A mob that must always react needs
Despawn: PERSISTENTorDespawn: falsein itsOptions, so that restarts and chunk unloads do not remove it, and a chunk that stays loaded.
Player Triggers
~onNetworkJoin, ~onServerSwitch, and ~onNetworkSignal for a signal sent to a player, run on the player. MythicMobs runs no skills for a trigger on a player, so these lines do nothing in the Skills of a mob. Use one of these instead:
- MythicCrucible items. MythicCrucible runs the matching lines of the items the player holds or wears and of their active equipment set bonuses. The player is the caster, so target them with
@self: a plain@triggerfinds nothing. For a join or a switch, the lines run only if MythicCrucible has already read the player's items at that moment. - The
eventslists of the backendconfig.yml, which need no MythicCrucible. See Events.
Skill Variables
Each trigger stores details of the event in skill variables. Read them with <skill.var.NAME>, for example <skill.var.player-name>. The skills in the matching events list get the same variables.
| Variable | Set by | Holds |
|---|---|---|
player-name |
onNetworkJoin, onServerSwitch, onNetworkQuit | The player's name |
player-uuid |
onNetworkJoin, onServerSwitch, onNetworkQuit | The player's UUID |
server |
onNetworkJoin, onServerSwitch | The server the player joined or arrived on |
from-server |
onServerSwitch | The server the player came from |
last-server |
onNetworkQuit | The server the player left the network from |
signal |
onNetworkSignal | The signal name, in the letter case the sender used |
signal-payload |
onNetworkSignal | The payload, empty if the sender set none |
origin-server |
onNetworkSignal | The server that sent the signal |
server, from-server and last-server hold the server names from velocity.toml.
A mob type with a SkillVariables section does not get these variables, because MythicMobs replaces them with the values of that section. Put the lines that read them on a mob type without SkillVariables.
Missed Events
The proxy passes each join, switch, quit and signal on once, when it happens, and never repeats it. A backend misses the event when:
- it is not connected to the proxy at that moment, for example while the proxy restarts, see When a Proxy Is Down,
- it has never been connected. A new backend learns the proxy's address from the first player who arrives, too late for that player's join or switch. List the proxy in
proxiesso that the backend connects at startup, see How Backends Find the Proxy, - its
server-nameis set to a name that is not its name in velocity.toml (letter case aside). It then gets no joins, switches or quits, see Server Names.
A join or switch also waits until the player's MythicMobs profile and network variables have loaded on the backend, and with MythicRPG Premium until MythicRPG has loaded the player and the variables of their active profile. It is dropped without a message when:
- the player leaves the backend before that,
- the wait takes longer than
lifecycle-timeout-seconds, see Options, - the proxy cannot load the player's variables. The proxy console then shows an error, see Troubleshooting.