Class ScriptRunManager
- All Implemented Interfaces:
IScriptRunManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyAction(IAction action) Applies the given action.createScriptRun(ScriptRunConfiguration configuration) Creates aIScriptRunwith the specifiedScriptRunConfiguration.createScriptRun(Path root, ScriptRunConfiguration configuration) Creates aIScriptRunwith the specifiedScriptRunConfigurationexecuting all valid scripts from the givenroot.createScriptRun(Path root, List<Path> files, ScriptRunConfiguration configuration) Creates aIScriptRunwith the specifiedScriptRunConfigurationexecuting the script files in thefileslist.createScriptRun(List<SourceFile> sources, ScriptRunConfiguration configuration) Creates aIScriptRunwith the specifiedScriptRunConfigurationexecuting the given ZenCodeSourceFiles.Obtains theIScriptRunInfoof the currently executingIScriptRun, if any.static ScriptRunManagerget()
-
Method Details
-
get
-
createScriptRun
Description copied from interface:IScriptRunManagerCreates aIScriptRunwith the specifiedScriptRunConfiguration.The script run will execute all scripts that are present in the default scripts directory. In this instance, a valid script file is identified by a
PathwhoseBasicFileAttributesreport a regular file and whose file name ends with.zs.- Specified by:
createScriptRunin interfaceIScriptRunManager- Parameters:
configuration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
-
createScriptRun
Description copied from interface:IScriptRunManagerCreates aIScriptRunwith the specifiedScriptRunConfigurationexecuting all valid scripts from the givenroot.In this instance, a valid script file is identified by a
PathwhoseBasicFileAttributesreport a regular file and whose file name ends with.zs.- Specified by:
createScriptRunin interfaceIScriptRunManager- Parameters:
root- The rootPathfrom which CraftTweaker should look for scripts.configuration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
-
createScriptRun
public IScriptRun createScriptRun(Path root, List<Path> files, ScriptRunConfiguration configuration) Description copied from interface:IScriptRunManagerCreates aIScriptRunwith the specifiedScriptRunConfigurationexecuting the script files in thefileslist.In this instance, all
Paths given infilesare assumed to be valid files. The path given as root, on the other hand, is used to properly identify the name of the script file for the ZenCode scripting environment. For this reason, it is mandatory forrootto be a valid parent of all files listed in thefileslist.- Specified by:
createScriptRunin interfaceIScriptRunManager- Parameters:
root- The root which contains all files listed infiles.files- The files that CraftTweaker should execute in the script run.configuration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
-
createScriptRun
Description copied from interface:IScriptRunManagerCreates aIScriptRunwith the specifiedScriptRunConfigurationexecuting the given ZenCodeSourceFiles.No restrictions are imposed on the type of the source files given.
- Specified by:
createScriptRunin interfaceIScriptRunManager- Parameters:
sources- The source files to execute in the script run.configuration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
-
currentRunInfo
Description copied from interface:IScriptRunManagerObtains theIScriptRunInfoof the currently executingIScriptRun, if any.If no script run is currently executing, a
NullPointerExceptionis thrown instead. It is the caller's responsibility to verify that this method can only ever be called during a script run execution.A script run is considered executing only when its
IScriptRun.execute()method is operating.To get information for a specific script run, consider using
IScriptRun.specificRunInfo()instead.- Specified by:
currentRunInfoin interfaceIScriptRunManager- Returns:
- The information for the currently executing script run, if any.
-
applyAction
Description copied from interface:IScriptRunManagerApplies the given action.Application of the action requires a
IScriptRunto be currently executing. Attempting to apply an action outside of a script run will result in anIllegalStateExceptionbeing thrown.- Specified by:
applyActionin interfaceIScriptRunManager- Parameters:
action- The action to apply.
-