Class ScriptManager
java.lang.Object
de.luckymcdev.foundryengine.script.common.ScriptManager
MANAGER: creates and owns everything else (definitions, runtimes, editor state, compiler, thread pools).
Compilation is parallel across bundles on a bounded daemon pool. To get that parallelism call
prepareAll(Map) once with all bundles before the first load(String, BundleFiles, ScriptEnv); a lone load(String, BundleFiles, ScriptEnv)
compiles just its bundle. Entry code (constructors, onLoad, onUnload) runs on the calling
thread's behalf under the sandbox timeout, in load order.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionload(String bundleId, BundleFiles files, ScriptEnv env) Waits for the bundle's compilation, then loads the entrypoints of one environment.prepare(String bundleId, BundleFiles files) Starts compiling a bundle if it is not known yet.prepareAll(Map<String, BundleFiles> bundles) Starts compiling all given bundles in parallel.Unloads, recompiles and reloads the environments that were loaded before.runtimes()setBundleEnabled(String bundleId, boolean enabled) setScriptEnabled(String bundleId, String script, boolean enabled) voidshutdown()voidUnloads every bundle (calling onUnload) and forgets it.voidunloadBundle(String bundleId) Unloads a single bundle: firesonUnloadon its entrypoints and closes its class loader.
-
Constructor Details
-
ScriptManager
-
-
Method Details
-
prepare
Starts compiling a bundle if it is not known yet. The future completes when it is compiled. -
prepareAll
Starts compiling all given bundles in parallel. -
load
Waits for the bundle's compilation, then loads the entrypoints of one environment. -
reload
Unloads, recompiles and reloads the environments that were loaded before. -
setBundleEnabled
-
setScriptEnabled
-
unloadBundle
Unloads a single bundle: firesonUnloadon its entrypoints and closes its class loader. The bundle is then forgotten so the nextload(String, BundleFiles, ScriptEnv)recompiles. -
unloadAll
public void unloadAll()Unloads every bundle (calling onUnload) and forgets it. Next load recompiles. -
shutdown
public void shutdown() -
runtimes
-
runtime
-
drainErrors
-