Class DefaultScriptProcess
- java.lang.Object
-
- com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
-
- com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess
-
- All Implemented Interfaces:
ScriptProcess,java.lang.Comparable<ScriptProcess>,java.lang.Runnable
public class DefaultScriptProcess extends AbstractScriptProcess
A script process that executes an external command.
-
-
Constructor Summary
Constructors Constructor Description DefaultScriptProcess(int scriptId, @NotNull java.lang.String filename, @NotNull CommandQueue commandQueue, @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull Stats stats, @NotNull FloorView floorView, @NotNull ItemSet itemSet, @NotNull java.lang.Iterable<Spell> spellsManager, @NotNull MapUpdaterState mapUpdaterState, @NotNull SkillSet skillSet)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidkillScript()Kills the script process.protected @Nullable java.lang.StringreadFromScript()Reads a line from the script process.protected @Nullable java.lang.StringwaitForTermination()Waits until the script has terminated.protected voidwriteToScript(@NotNull java.lang.String data)Sends some data to the script process.-
Methods inherited from class com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
addScriptProcessListener, commandSent, compareTo, equals, getFilename, getScriptId, hashCode, run, toString
-
-
-
-
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.IOExceptionCreates a new instance.- Parameters:
scriptId- the script ID identifying the new scriptfilename- the command including arguments to executecommandQueue- the command queue for sending commandscrossfireServerConnection- the server connectionstats- the stats instance to watchfloorView- the floor view to useitemSet- the item set instance to usespellsManager- the spells manager instance to usemapUpdaterState- the map updater state instance to useskillSet- 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.IOExceptionDescription copied from class:AbstractScriptProcessReads a line from the script process.- Specified by:
readFromScriptin classAbstractScriptProcess- Returns:
- the line or
nullif the script has exited - Throws:
java.io.IOException- if reading failed
-
waitForTermination
@Nullable protected @Nullable java.lang.String waitForTermination()
Description copied from class:AbstractScriptProcessWaits until the script has terminated.- Specified by:
waitForTerminationin classAbstractScriptProcess- Returns:
- the termination reason or
nullif the script exited normally
-
writeToScript
protected void writeToScript(@NotNull @NotNull java.lang.String data) throws java.io.IOExceptionDescription copied from class:AbstractScriptProcessSends some data to the script process.- Specified by:
writeToScriptin classAbstractScriptProcess- Parameters:
data- the data- Throws:
java.io.IOException- if sending fails
-
killScript
public void killScript()
Description copied from interface:ScriptProcessKills the script process. Does nothing if the process is not running.
-
-