Class ScriptServiceImpl

All Implemented Interfaces:
ScriptServiceGrpc.AsyncService, io.grpc.BindableService

public final class ScriptServiceImpl extends ScriptServiceGrpc.ScriptServiceImplBase
gRPC service implementation for visual script management. Handles CRUD operations for scripts and script execution lifecycle.
  • Constructor Details

    • ScriptServiceImpl

      public ScriptServiceImpl(SoulFireServer soulFireServer)
  • Method Details

    • startAllNonPausedScripts

      public void startAllNonPausedScripts(UUID instanceId)
      Starts all non-paused scripts for a given instance. Called on server startup.
    • startAllNonPausedScripts

      public void startAllNonPausedScripts()
      Starts all non-paused scripts across all instances. Called on server startup.
    • createScript

      public void createScript(CreateScriptRequest request, io.grpc.stub.StreamObserver<CreateScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Creates a new script in the specified instance.
      The script can be created with initial nodes and edges, or as a blank script
      to be edited later.
      Returns: The complete script data including the generated ID
      Errors: NOT_FOUND if instance does not exist
      Errors: PERMISSION_DENIED if user lacks script creation permission
      Errors: INVALID_ARGUMENT if required fields are missing or invalid
      
    • getScript

      public void getScript(GetScriptRequest request, io.grpc.stub.StreamObserver<GetScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Retrieves a specific script by its ID.
      Returns the complete script data including all nodes and edges.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script read permission
      
    • updateScript

      public void updateScript(UpdateScriptRequest request, io.grpc.stub.StreamObserver<UpdateScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Updates an existing script's metadata and/or node graph.
      Only specified fields are updated; others remain unchanged.
      Use update_nodes/update_edges flags to explicitly set empty lists.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script update permission
      Errors: INVALID_ARGUMENT if update data is invalid
      
    • deleteScript

      public void deleteScript(DeleteScriptRequest request, io.grpc.stub.StreamObserver<DeleteScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Permanently deletes a script.
      If the script is currently active, it will be deactivated first.
      This operation cannot be undone.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script delete permission
      
    • listScripts

      public void listScripts(ListScriptsRequest request, io.grpc.stub.StreamObserver<ListScriptsResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Lists all scripts in the specified instance.
      Returns summary information (ScriptInfo) without full node/edge data
      to reduce response size.
      Errors: NOT_FOUND if instance does not exist
      Errors: PERMISSION_DENIED if user lacks script read permission
      
    • activateScript

      public void activateScript(ActivateScriptRequest request, io.grpc.stub.StreamObserver<ScriptEvent> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Activates a script by registering its trigger event listeners.
      The script will begin responding to trigger events (tick, chat, etc.).
      Returns a stream of execution events as triggers fire and nodes execute.
      The stream remains open until the script is deactivated.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script execution permission
      Errors: FAILED_PRECONDITION if script is already active
      Errors: INVALID_ARGUMENT if script graph is invalid (e.g., no trigger nodes)
      
    • deactivateScript

      public void deactivateScript(DeactivateScriptRequest request, io.grpc.stub.StreamObserver<DeactivateScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Deactivates an active script.
      Unregisters all event listeners and cancels any pending async operations.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script execution permission
      Errors: FAILED_PRECONDITION if script is not active
      
    • getScriptStatus

      public void getScriptStatus(GetScriptStatusRequest request, io.grpc.stub.StreamObserver<GetScriptStatusResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Gets the current status of a script.
      Returns whether the script is active, which node is executing, and activation count.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script read permission
      
    • subscribeScriptLogs

      public void subscribeScriptLogs(SubscribeScriptLogsRequest request, io.grpc.stub.StreamObserver<ScriptLogEntry> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Subscribes to log entries generated during script execution.
      Returns a stream of log entries at or above the specified minimum level.
      The stream remains open until cancelled by the client.
      Errors: NOT_FOUND if instance or script does not exist
      Errors: PERMISSION_DENIED if user lacks script log subscription permission
      
    • getNodeTypes

      public void getNodeTypes(GetNodeTypesRequest request, io.grpc.stub.StreamObserver<GetNodeTypesResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Gets all available node types with their metadata.
      This enables clients to render the node editor without hardcoded knowledge
      of specific node types. The response includes port definitions, categories,
      display names, and all other information needed to render and validate nodes.
      This endpoint is cacheable - node types only change between server versions.
      
    • getRegistryData

      public void getRegistryData(GetRegistryDataRequest request, io.grpc.stub.StreamObserver<GetRegistryDataResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Gets Minecraft registry data for autocomplete and validation.
      Returns blocks, entities, items, and biomes that can be used in scripts.
      This endpoint is cacheable - registry data only changes between server versions.
      
    • validateScript

      public void validateScript(ValidateScriptRequest request, io.grpc.stub.StreamObserver<ValidateScriptResponse> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Validates a script graph without saving it.
      Returns all diagnostics (errors and warnings) for the given nodes and edges.
      Useful for live validation in the editor without requiring a save.
      
    • dryRunScript

      public void dryRunScript(DryRunScriptRequest request, io.grpc.stub.StreamObserver<ScriptEvent> responseObserver)
      Description copied from interface: ScriptServiceGrpc.AsyncService
      Dry-runs a script from a specified trigger with mock inputs.
      Executes the graph without requiring an active instance.
      Returns execution events as a stream for the editor to display.