public abstract class AbstractScriptProcess extends java.lang.Object implements java.lang.Runnable, ScriptProcess
ScriptProcess
es.Modifier | Constructor and Description |
---|---|
protected |
AbstractScriptProcess(int scriptId,
@NotNull java.lang.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.
|
Modifier and Type | Method and Description |
---|---|
void |
addScriptProcessListener(@NotNull ScriptProcessListener scriptProcessListener)
Adds a
ScriptProcessListener to be notified. |
void |
commandSent(@NotNull java.lang.String cmd)
Sends a message to the script process.
|
int |
compareTo(@NotNull ScriptProcess o) |
boolean |
equals(@Nullable java.lang.Object obj) |
@NotNull java.lang.String |
getFilename()
Returns the script's filename.
|
int |
getScriptId()
Returns the script ID identifying this script instance.
|
int |
hashCode() |
protected abstract @Nullable java.lang.String |
readFromScript()
Reads a line from the script process.
|
void |
run() |
@NotNull java.lang.String |
toString() |
protected abstract @Nullable java.lang.String |
waitForTermination()
Waits until the script has terminated.
|
protected abstract void |
writeToScript(@NotNull java.lang.String data)
Sends some data to the script process.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
killScript
protected AbstractScriptProcess(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 SpellsManager spellsManager, @NotNull @NotNull MapUpdaterState mapUpdaterState, @NotNull @NotNull SkillSet skillSet)
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 namespublic int getScriptId()
ScriptProcess
getScriptId
in interface ScriptProcess
@NotNull public @NotNull java.lang.String getFilename()
ScriptProcess
getFilename
in interface ScriptProcess
public void run()
run
in interface java.lang.Runnable
@Nullable protected abstract @Nullable java.lang.String readFromScript() throws java.io.IOException
null
if the script has exitedjava.io.IOException
- if reading failed@Nullable protected abstract @Nullable java.lang.String waitForTermination()
null
if the script exited
normallypublic void commandSent(@NotNull @NotNull java.lang.String cmd)
ScriptProcess
commandSent
in interface ScriptProcess
cmd
- the message to sendprotected abstract void writeToScript(@NotNull @NotNull java.lang.String data) throws java.io.IOException
data
- the datajava.io.IOException
- if sending fails@NotNull public @NotNull java.lang.String toString()
toString
in class java.lang.Object
public void addScriptProcessListener(@NotNull @NotNull ScriptProcessListener scriptProcessListener)
ScriptProcess
ScriptProcessListener
to be notified.addScriptProcessListener
in interface ScriptProcess
scriptProcessListener
- the listener to addpublic int compareTo(@NotNull @NotNull ScriptProcess o)
compareTo
in interface java.lang.Comparable<ScriptProcess>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable @Nullable java.lang.Object obj)
equals
in class java.lang.Object