Class DefaultScriptProcess

    • Constructor Detail

      • DefaultScriptProcess

        public DefaultScriptProcess​(int scriptId,
                                    @NotNull
                                    @NotNull java.lang.String filename,
                                    @NotNull
                                    @NotNull CommandQueue commandQueue,
                                    @NotNull
                                    @NotNull CrossfireServerConnection crossfireServerConnection,
                                    @NotNull
                                    @NotNull Stats stats,
                                    @NotNull
                                    @NotNull FloorView floorView,
                                    @NotNull
                                    @NotNull ItemSet itemSet,
                                    @NotNull
                                    @NotNull java.lang.Iterable<Spell> spellsManager,
                                    @NotNull
                                    @NotNull MapUpdaterState mapUpdaterState,
                                    @NotNull
                                    @NotNull SkillSet skillSet)
                             throws java.io.IOException
        Creates a new instance.
        Parameters:
        scriptId - the script ID identifying the new script
        filename - the command including arguments to execute
        commandQueue - the command queue for sending commands
        crossfireServerConnection - the server connection
        stats - the stats instance to watch
        floorView - the floor view to use
        itemSet - the item set instance to use
        spellsManager - the spells manager instance to use
        mapUpdaterState - the map updater state instance to use
        skillSet - the skill set for looking up skill names
        Throws:
        java.io.IOException - if the script cannot be created
    • Method Detail

      • readFromScript

        @Nullable
        protected @Nullable java.lang.String readFromScript()
                                                     throws java.io.IOException
        Description copied from class: AbstractScriptProcess
        Reads a line from the script process.
        Specified by:
        readFromScript in class AbstractScriptProcess
        Returns:
        the line or null if the script has exited
        Throws:
        java.io.IOException - if reading failed
      • waitForTermination

        @Nullable
        protected @Nullable java.lang.String waitForTermination()
        Description copied from class: AbstractScriptProcess
        Waits until the script has terminated.
        Specified by:
        waitForTermination in class AbstractScriptProcess
        Returns:
        the termination reason or null if the script exited normally
      • writeToScript

        protected void writeToScript​(@NotNull
                                     @NotNull java.lang.String data)
                              throws java.io.IOException
        Description copied from class: AbstractScriptProcess
        Sends some data to the script process.
        Specified by:
        writeToScript in class AbstractScriptProcess
        Parameters:
        data - the data
        Throws:
        java.io.IOException - if sending fails
      • killScript

        public void killScript()
        Description copied from interface: ScriptProcess
        Kills the script process. Does nothing if the process is not running.