Class ScriptTriggerService
java.lang.Object
com.soulfiremc.server.script.ScriptTriggerService
Service that manages event subscriptions for trigger nodes in scripts. When a script is started, this service registers appropriate event listeners for each trigger node and executes downstream nodes when events fire.
Uses Reactor Sinks with backpressure to prevent overwhelming the system when high-frequency events (like ticks) fire faster than they can be processed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasActiveTriggers(UUID scriptId) Checks if a script has active triggers.voidregisterTriggers(UUID scriptId, ScriptGraph graph, ReactiveScriptContext context, ReactiveScriptEngine engine) Registers event listeners for all trigger nodes in the script.voidunregisterTriggers(UUID scriptId) Unregisters all event listeners for a script.
-
Constructor Details
-
ScriptTriggerService
public ScriptTriggerService()
-
-
Method Details
-
registerTriggers
public void registerTriggers(UUID scriptId, ScriptGraph graph, ReactiveScriptContext context, ReactiveScriptEngine engine) Registers event listeners for all trigger nodes in the script. Uses reactive sinks with backpressure for high-frequency triggers.- Parameters:
scriptId- the script IDgraph- the script graphcontext- the reactive execution contextengine- the reactive script engine
-
unregisterTriggers
Unregisters all event listeners for a script.- Parameters:
scriptId- the script ID
-
hasActiveTriggers
Checks if a script has active triggers.- Parameters:
scriptId- the script ID- Returns:
- true if the script has registered triggers
-