Interface IScriptRunManager
- All Known Implementing Classes:
ScriptRunManager
IScriptRuns, while also dealing with IActions.- Since:
- 9.1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidapplyAction(IAction action) Applies the given action.createScriptRun(ScriptRunConfiguration configuration) Creates anIScriptRunwith the specifiedScriptRunConfiguration.createScriptRun(Path root, ScriptDiscoveryConfiguration discoveryConfiguration, ScriptRunConfiguration runConfiguration) Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting all valid scripts discovered according to the givenScriptDiscoveryConfigurationfrom the givenroot.createScriptRun(Path root, ScriptRunConfiguration configuration) Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting all valid scripts from the givenroot.createScriptRun(Path root, List<Path> files, ScriptRunConfiguration configuration) Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting the script files in thefileslist.createScriptRun(List<SourceFile> sources, ScriptRunConfiguration configuration) Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting the given ZenCodeSourceFiles.Obtains theIScriptRunInfoof the currently executingIScriptRun, if any.
-
Method Details
-
createScriptRun
Creates anIScriptRunwith 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.During the discovery phase, any file with a suspicious name will raise a warning in the logs.
- Parameters:
configuration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
- Since:
- 9.1.0
-
createScriptRun
Creates anIScriptRunwith 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.During the discovery phase, any file with a suspicious name will raise a warning in the logs.
- 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.
- Since:
- 9.1.0
-
createScriptRun
IScriptRun createScriptRun(Path root, ScriptDiscoveryConfiguration discoveryConfiguration, ScriptRunConfiguration runConfiguration) Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting all valid scripts discovered according to the givenScriptDiscoveryConfigurationfrom the givenroot.In this instance, a valid script file is identified by a
PathwhoseBasicFileAttributesreport a regular file and whose file name ends with.zs.- Parameters:
root- The rootPathfrom which CraftTweaker should look for scripts.discoveryConfiguration- The configuration for the discovery process.runConfiguration- The configuration of the script run.- Returns:
- A script run that carries out the specified operations.
- Since:
- 10.1.0
-
createScriptRun
Creates anIScriptRunwith 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.- 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.
- Since:
- 9.1.0
-
createScriptRun
Creates anIScriptRunwith the specifiedScriptRunConfigurationexecuting the given ZenCodeSourceFiles.No restrictions are imposed on the type of the source files given.
- 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.
- Since:
- 9.1.0
-
currentRunInfo
IScriptRunInfo currentRunInfo()Obtains 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.- Returns:
- The information for the currently executing script run, if any.
- Since:
- 9.1.0
-
applyAction
Applies the given action.Application of the action requires an
IScriptRunto be currently executing. Attempting to apply an action outside of a script run will result in anIllegalStateExceptionbeing thrown.- Parameters:
action- The action to apply.- Since:
- 9.1.0
-