Class ExecutionRecorder
java.lang.Object
com.soulfiremc.server.script.ExecutionRecorder
- All Implemented Interfaces:
ScriptEventListener
Records script execution events for replay in the editor.
Implements ScriptEventListener to capture all events during execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType of recorded event.static final recordA single recorded execution event with timestamp and data. -
Field Summary
Fields inherited from interface ScriptEventListener
NOOP -
Constructor Summary
ConstructorsConstructorDescriptionCreates a standalone recorder with no delegation.ExecutionRecorder(ScriptEventListener delegate) Creates a recorder that also delegates events to another listener. -
Method Summary
Modifier and TypeMethodDescriptionReturns the recorded events as an unmodifiable list.voidonExecutionStats(long nodeCount, long maxCount) Called when a trigger chain completes with execution statistics.voidCalled when a script logs a message (via Print node).voidonNodeCompleted(String nodeId, Map<String, NodeValue> outputs) Called when a node completes execution successfully.voidonNodeCompleted(String nodeId, Map<String, NodeValue> outputs, long executionTimeNanos) Called when a node completes with execution time for profiling.voidonNodeError(String nodeId, String error) Called when a node encounters an error during execution.voidonNodeStarted(String nodeId) Called when a node starts executing.voidCalled when the script execution is cancelled.voidonScriptCompleted(boolean success) Called when the entire script completes execution.intsize()Returns the number of recorded events.
-
Constructor Details
-
ExecutionRecorder
Creates a recorder that also delegates events to another listener. -
ExecutionRecorder
public ExecutionRecorder()Creates a standalone recorder with no delegation.
-
-
Method Details
-
onNodeStarted
Description copied from interface:ScriptEventListenerCalled when a node starts executing.- Specified by:
onNodeStartedin interfaceScriptEventListener- Parameters:
nodeId- the unique identifier of the node
-
onNodeCompleted
Description copied from interface:ScriptEventListenerCalled when a node completes execution successfully.- Specified by:
onNodeCompletedin interfaceScriptEventListener- Parameters:
nodeId- the unique identifier of the nodeoutputs- the output values produced by the node
-
onNodeCompleted
Description copied from interface:ScriptEventListenerCalled when a node completes with execution time for profiling.- Specified by:
onNodeCompletedin interfaceScriptEventListener- Parameters:
nodeId- the node identifieroutputs- the output values producedexecutionTimeNanos- execution time in nanoseconds
-
onNodeError
Description copied from interface:ScriptEventListenerCalled when a node encounters an error during execution.- Specified by:
onNodeErrorin interfaceScriptEventListener- Parameters:
nodeId- the unique identifier of the nodeerror- description of the error that occurred
-
onLog
Description copied from interface:ScriptEventListenerCalled when a script logs a message (via Print node).- Specified by:
onLogin interfaceScriptEventListener- Parameters:
level- the log level (debug, info, warn, error)message- the log message
-
onExecutionStats
public void onExecutionStats(long nodeCount, long maxCount) Description copied from interface:ScriptEventListenerCalled when a trigger chain completes with execution statistics.- Specified by:
onExecutionStatsin interfaceScriptEventListener- Parameters:
nodeCount- the total number of node executionsmaxCount- the maximum allowed node executions
-
onScriptCompleted
public void onScriptCompleted(boolean success) Description copied from interface:ScriptEventListenerCalled when the entire script completes execution.- Specified by:
onScriptCompletedin interfaceScriptEventListener- Parameters:
success- true if the script completed without errors
-
onScriptCancelled
public void onScriptCancelled()Description copied from interface:ScriptEventListenerCalled when the script execution is cancelled.- Specified by:
onScriptCancelledin interfaceScriptEventListener
-
getEvents
Returns the recorded events as an unmodifiable list. -
size
public int size()Returns the number of recorded events.
-