Class ExecutionRecorder

java.lang.Object
com.soulfiremc.server.script.ExecutionRecorder
All Implemented Interfaces:
ScriptEventListener

public final class ExecutionRecorder extends Object implements ScriptEventListener
Records script execution events for replay in the editor. Implements ScriptEventListener to capture all events during execution.
  • Constructor Details

    • ExecutionRecorder

      public ExecutionRecorder(ScriptEventListener delegate)
      Creates a recorder that also delegates events to another listener.
    • ExecutionRecorder

      public ExecutionRecorder()
      Creates a standalone recorder with no delegation.
  • Method Details

    • onNodeStarted

      public void onNodeStarted(String nodeId)
      Description copied from interface: ScriptEventListener
      Called when a node starts executing.
      Specified by:
      onNodeStarted in interface ScriptEventListener
      Parameters:
      nodeId - the unique identifier of the node
    • onNodeCompleted

      public void onNodeCompleted(String nodeId, Map<String, NodeValue> outputs)
      Description copied from interface: ScriptEventListener
      Called when a node completes execution successfully.
      Specified by:
      onNodeCompleted in interface ScriptEventListener
      Parameters:
      nodeId - the unique identifier of the node
      outputs - the output values produced by the node
    • onNodeCompleted

      public void onNodeCompleted(String nodeId, Map<String, NodeValue> outputs, long executionTimeNanos)
      Description copied from interface: ScriptEventListener
      Called when a node completes with execution time for profiling.
      Specified by:
      onNodeCompleted in interface ScriptEventListener
      Parameters:
      nodeId - the node identifier
      outputs - the output values produced
      executionTimeNanos - execution time in nanoseconds
    • onNodeError

      public void onNodeError(String nodeId, String error)
      Description copied from interface: ScriptEventListener
      Called when a node encounters an error during execution.
      Specified by:
      onNodeError in interface ScriptEventListener
      Parameters:
      nodeId - the unique identifier of the node
      error - description of the error that occurred
    • onLog

      public void onLog(String level, String message)
      Description copied from interface: ScriptEventListener
      Called when a script logs a message (via Print node).
      Specified by:
      onLog in interface ScriptEventListener
      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: ScriptEventListener
      Called when a trigger chain completes with execution statistics.
      Specified by:
      onExecutionStats in interface ScriptEventListener
      Parameters:
      nodeCount - the total number of node executions
      maxCount - the maximum allowed node executions
    • onScriptCompleted

      public void onScriptCompleted(boolean success)
      Description copied from interface: ScriptEventListener
      Called when the entire script completes execution.
      Specified by:
      onScriptCompleted in interface ScriptEventListener
      Parameters:
      success - true if the script completed without errors
    • onScriptCancelled

      public void onScriptCancelled()
      Description copied from interface: ScriptEventListener
      Called when the script execution is cancelled.
      Specified by:
      onScriptCancelled in interface ScriptEventListener
    • getEvents

      Returns the recorded events as an unmodifiable list.
    • size

      public int size()
      Returns the number of recorded events.