public class ScriptManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private CommandQueue |
commandQueue
The
CommandQueue for sending commands. |
private CrossfireServerConnection |
crossfireServerConnection
The
CrossfireServerConnection instance. |
private FloorView |
floorView
The
FloorView to use. |
private ItemSet |
itemSet
The
ItemSet instance to use. |
private MapUpdaterState |
mapUpdaterState
The
MapUpdaterState instance to use. |
private int |
nextScriptId
The script ID for the next created script.
|
private java.util.Collection<ScriptProcess> |
scriptProcesses
All running
ScriptProcess es. |
private SkillSet |
skillSet
The
SkillSet for looking up skill names. |
private java.lang.Iterable<Spell> |
spellsManager
The spells manager instance to use.
|
private Stats |
stats
The
Stats instance to watch. |
Constructor and Description |
---|
ScriptManager(CommandQueue commandQueue,
CrossfireServerConnection crossfireServerConnection,
Stats stats,
FloorView floorView,
ItemSet itemSet,
java.lang.Iterable<Spell> spellsManager,
MapUpdaterState mapUpdaterState,
SkillSet skillSet)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
private java.util.Set<ScriptProcess> |
getScriptByScriptId(int scriptId)
Returns all running scripts matching a given script ID.
|
java.util.Set<ScriptProcess> |
getScripts(java.lang.String partialScriptName)
Returns all running scripts matching a given (partial) name or a script
ID.
|
private java.util.Set<ScriptProcess> |
getScriptsByName(java.lang.CharSequence partialScriptName)
Returns all running scripts matching a given (partial) name.
|
boolean |
hasScripts()
Returns whether at least one script is running.
|
void |
newScript(java.lang.String command)
Creates a new script instance.
|
@NotNull private final CommandQueue commandQueue
CommandQueue
for sending commands.@NotNull private final CrossfireServerConnection crossfireServerConnection
CrossfireServerConnection
instance.@NotNull private final MapUpdaterState mapUpdaterState
MapUpdaterState
instance to use.private int nextScriptId
@NotNull private final java.util.Collection<ScriptProcess> scriptProcesses
ScriptProcess
es.@NotNull private final java.lang.Iterable<Spell> spellsManager
public ScriptManager(@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)
commandQueue
- the command queue for sending commandscrossfireServerConnection
- the connection instancestats
- 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@NotNull private java.util.Set<ScriptProcess> getScriptByScriptId(int scriptId)
scriptId
- the script ID@NotNull public java.util.Set<ScriptProcess> getScripts(@NotNull java.lang.String partialScriptName)
partialScriptName
- the partial name or a script ID to match
against; an empty string matches all scripts@NotNull private java.util.Set<ScriptProcess> getScriptsByName(@NotNull java.lang.CharSequence partialScriptName)
partialScriptName
- the partial script name; an empty string matches
all scriptspublic boolean hasScripts()
public void newScript(@NotNull java.lang.String command)
command
- the script command including arguments