Class DefaultScriptProcess
java.lang.Object
com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess
- All Implemented Interfaces:
ScriptProcess,Comparable<ScriptProcess>,Runnable
A script process that executes an external command.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultScriptProcess(int scriptId, @NotNull String filename, @NotNull CommandQueue commandQueue, @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull Stats stats, @NotNull FloorView floorView, @NotNull ItemSet itemSet, @NotNull SpellsManager spellsManager, @NotNull MapUpdaterState mapUpdaterState, @NotNull SkillSet skillSet) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidKills the script process.protected @Nullable StringReads a line from the script process.protected @Nullable StringWaits until the script has terminated.protected voidwriteToScript(@NotNull 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 Details
-
DefaultScriptProcess
public DefaultScriptProcess(int scriptId, @NotNull @NotNull String filename, @NotNull @NotNull CommandQueue commandQueue, @NotNull @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull @NotNull Stats stats, @NotNull @NotNull FloorView floorView, @NotNull @NotNull ItemSet itemSet, @NotNull @NotNull SpellsManager spellsManager, @NotNull @NotNull MapUpdaterState mapUpdaterState, @NotNull @NotNull SkillSet skillSet) throws IOException Creates 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:
IOException- if the script cannot be created
-
-
Method Details
-
readFromScript
Description copied from class:AbstractScriptProcessReads a line from the script process.- Specified by:
readFromScriptin classAbstractScriptProcess- Returns:
- the line or
nullif the script has exited - Throws:
IOException- if reading failed
-
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
Description copied from class:AbstractScriptProcessSends some data to the script process.- Specified by:
writeToScriptin classAbstractScriptProcess- Parameters:
data- the data- Throws:
IOException- if sending fails
-
killScript
public void killScript()Description copied from interface:ScriptProcessKills the script process. Does nothing if the process is not running.
-