testing script loading stuff

is not allowed in console, only from `LoadedMod`s.
This commit is contained in:
DeltaNedas 2020-01-30 00:38:51 +00:00 committed by GitHub
parent 864c73f791
commit 677debd475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,6 +68,10 @@ public class Scripts implements Disposable{
}
public void run(LoadedMod mod, Fi file){
new RequireBuilder()
.setModuleScriptProvider(new SoftCachingModuleScriptProvider(
new UrlModuleSourceProvider(Arrays.asList(new URI[] {file.child("scripts").file().toURI()}), null)))
.setSandboxed(true).createRequire(context, scope).install(scope);
run(wrapper.replace("$SCRIPT_NAME$", mod.name + "/" + file.nameWithoutExtension()).replace("$CODE$", file.readString()).replace("$MOD_NAME$", mod.name), file.name());
}