Gatewaysjs Wiki › Guides › Listen to Gateway Events and Trigger Custom Actions
Listen to Gateway Events and Trigger Custom Actions
Understanding Gateway Event Listeners
Gatewaysjs Mod fires events at key moments during gateway fights: when the gateway opens, when waves start or end, when mobs spawn, and when the arena fails. You can hook into these events with KubeJS to run custom code.
In your server_scripts, create event listeners for:
gateway.open– runs when a player activates the gatewaygateway.wave.start– triggers at the beginning of each wavegateway.wave.end– fires when all mobs in a wave are defeatedgateway.mob.spawn– executes when an entity enters the arenagateway.fail– activates if players lose
Executing Actions Within Events
Inside each listener, you can play sounds, spawn particles, modify the boss bar display, or grant temporary buffs. For example, on wave start, play an ominous sound and apply Strength to all players. On wave end, spawn reward items or trigger a celebration effect.
Use the event object to access arena data, player references, and mob information. This lets you create immersive, reactive arena experiences that respond to combat flow.