Cleanup of scripts

This commit is contained in:
Anuken
2020-01-19 09:49:55 -05:00
parent 48b623882a
commit 87b4c37d82
2 changed files with 4 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -10,7 +10,9 @@ import mindustry.mod.Mods.*;
import org.mozilla.javascript.*;
public class Scripts implements Disposable{
private final Array<String> blacklist = Array.with("net", "classaccess", ".io", "io.", "files", "reflect");
private final Array<String> blacklist = Array.with("net", "files", "reflect", "javax", "rhino", "file", "channels", "jdk",
"runtime", "util.os", "rmi", "security", "org.", "sun.", "beans", "sql", "http", "exec", "compiler", "process", "system");
private final Array<String> whitelist = Array.with("mindustry.net");
private final Context context;
private final String wrapper;
private Scriptable scope;
@@ -20,7 +22,7 @@ public class Scripts implements Disposable{
Time.mark();
context = Vars.platform.getScriptContext();
context.setClassShutter(type -> !blacklist.contains(type.toLowerCase()::contains) || type.contains("mindustry.net"));
context.setClassShutter(type -> !blacklist.contains(type.toLowerCase()::contains) || whitelist.contains(type.toLowerCase()::contains));
context.getWrapFactory().setJavaPrimitiveWrap(false);
scope = new ImporterTopLevel(context);