Class AbstractScriptProcess
java.lang.Object
com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
- All Implemented Interfaces:
ScriptProcess,Comparable<ScriptProcess>,Runnable
- Direct Known Subclasses:
DefaultScriptProcess
Default implementation for
ScriptProcesses.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractScriptProcess(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 TypeMethodDescriptionvoidaddScriptProcessListener(@NotNull ScriptProcessListener scriptProcessListener) Adds aScriptProcessListenerto be notified.voidcommandSent(@NotNull String cmd) Sends a message to the script process.intcompareTo(@NotNull ScriptProcess o) boolean@NotNull StringReturns the script's filename.intReturns the script ID identifying this script instance.inthashCode()protected abstract @Nullable StringReads a line from the script process.voidrun()@NotNull StringtoString()protected abstract @Nullable StringWaits until the script has terminated.protected abstract voidwriteToScript(@NotNull String data) Sends some data to the script process.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.realtime.crossfire.jxclient.scripts.ScriptProcess
killScript
-
Constructor Details
-
AbstractScriptProcess
protected AbstractScriptProcess(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) 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
-
-
Method Details
-
getScriptId
public int getScriptId()Description copied from interface:ScriptProcessReturns the script ID identifying this script instance.- Specified by:
getScriptIdin interfaceScriptProcess- Returns:
- the script ID
-
getFilename
Description copied from interface:ScriptProcessReturns the script's filename.- Specified by:
getFilenamein interfaceScriptProcess- Returns:
- the script's filename
-
run
public void run() -
readFromScript
Reads a line from the script process.- Returns:
- the line or
nullif the script has exited - Throws:
IOException- if reading failed
-
waitForTermination
Waits until the script has terminated.- Returns:
- the termination reason or
nullif the script exited normally
-
commandSent
Description copied from interface:ScriptProcessSends a message to the script process.- Specified by:
commandSentin interfaceScriptProcess- Parameters:
cmd- the message to send
-
writeToScript
Sends some data to the script process.- Parameters:
data- the data- Throws:
IOException- if sending fails
-
toString
-
addScriptProcessListener
Description copied from interface:ScriptProcessAdds aScriptProcessListenerto be notified.- Specified by:
addScriptProcessListenerin interfaceScriptProcess- Parameters:
scriptProcessListener- the listener to add
-
compareTo
- Specified by:
compareToin interfaceComparable<ScriptProcess>
-
hashCode
public int hashCode() -
equals
-