cleanup
This commit is contained in:
@@ -107,7 +107,7 @@ public class Scripts implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class ScriptModuleProvider extends UrlModuleSourceProvider{
|
private class ScriptModuleProvider extends UrlModuleSourceProvider{
|
||||||
private Pattern directory = Pattern.compile("^(.+?)/(.+)");
|
private Pattern directory = Pattern.compile("^(.+?)/(.+)");
|
||||||
public ScriptModuleProvider(){
|
public ScriptModuleProvider(){
|
||||||
super(null, null);
|
super(null, null);
|
||||||
}
|
}
|
||||||
@@ -119,19 +119,19 @@ public class Scripts implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ModuleSource loadSource(LoadedMod mod, String moduleId, Fi root, Object validator) throws IOException, URISyntaxException{
|
private ModuleSource loadSource(LoadedMod mod, String moduleId, Fi root, Object validator) throws IOException, URISyntaxException{
|
||||||
Matcher matched = directory.matcher(moduleId);
|
Matcher matched = directory.matcher(moduleId);
|
||||||
if(matched.find()){
|
if(matched.find()){
|
||||||
LoadedMod required = Vars.mods.locateMod(matched.group(1));
|
LoadedMod required = Vars.mods.locateMod(matched.group(1));
|
||||||
String script = matched.group(2);
|
String script = matched.group(2);
|
||||||
if(required == null || root == required.root.child("scripts")){ // Mod not found, or already using a mod
|
if(required == null || root == required.root.child("scripts")){ // Mod not found, or already using a mod
|
||||||
Fi dir = root.child(matched.group(1));
|
Fi dir = root.child(matched.group(1));
|
||||||
if(dir == null) return null; // Mod and folder not found
|
if(dir == null) return null; // Mod and folder not found
|
||||||
return loadSource(mod, script, dir, validator);
|
return loadSource(mod, script, dir, validator);
|
||||||
}
|
}
|
||||||
return loadSource(required, script, required.root.child("scripts"), validator);
|
return loadSource(required, script, required.root.child("scripts"), validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fi module = root.child(moduleId + ".js");
|
Fi module = root.child(moduleId + ".js");
|
||||||
if(!module.exists() || module.isDirectory()) return null;
|
if(!module.exists() || module.isDirectory()) return null;
|
||||||
return new ModuleSource(
|
return new ModuleSource(
|
||||||
new InputStreamReader(new ByteArrayInputStream((fillWrapper(module)).getBytes())),
|
new InputStreamReader(new ByteArrayInputStream((fillWrapper(module)).getBytes())),
|
||||||
|
|||||||
Reference in New Issue
Block a user