Removed script wrapper

This commit is contained in:
Anuken
2020-02-11 17:50:16 -05:00
parent fb302d49c7
commit 3102931cb4
5 changed files with 71 additions and 84 deletions

View File

@@ -30,13 +30,6 @@ public class ScriptStubGenerator{
DataInputStream.class, DataOutputStream.class, Integer.class, Float.class, Double.class, Long.class, Boolean.class, Short.class, Byte.class, Character.class);
Array<String> nopackage = Array.with("java.lang", "java");
String fileTemplate = "package mindustry.mod;\n" +
"\nimport arc.struct.*;\n" +
"//obviously autogenerated, do not touch\n" +
"public class ClassAccess{\n" +
"\tpublic static final ObjectSet<String> allowedClassNames = ObjectSet.with($ALLOWED_CLASS_NAMES$);\n" +
"}";
List<ClassLoader> classLoadersList = new LinkedList<>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());
@@ -73,8 +66,5 @@ public class ScriptStubGenerator{
//Log.info(result);
new Fi("core/assets/scripts/global.js").writeString(result.toString());
new Fi("core/src/mindustry/mod/ClassAccess.java").writeString(fileTemplate
.replace("$ALLOWED_CLASSES$", classes.toString(", ", type -> type.getName() + ".class"))
.replace("$ALLOWED_CLASS_NAMES$", classes.toString(", ", type -> "\"" + type.getName() + "\"")));
}
}