mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-12 19:09:34 +07:00
cleanup
This commit is contained in:
parent
b93692ad41
commit
c458c77322
@ -107,7 +107,7 @@ public class Scripts implements Disposable{
|
||||
}
|
||||
|
||||
private class ScriptModuleProvider extends UrlModuleSourceProvider{
|
||||
private Pattern directory = Pattern.compile("^(.+?)/(.+)");
|
||||
private Pattern directory = Pattern.compile("^(.+?)/(.+)");
|
||||
public ScriptModuleProvider(){
|
||||
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{
|
||||
Matcher matched = directory.matcher(moduleId);
|
||||
if(matched.find()){
|
||||
LoadedMod required = Vars.mods.locateMod(matched.group(1));
|
||||
String script = matched.group(2);
|
||||
if(required == null || root == required.root.child("scripts")){ // Mod not found, or already using a mod
|
||||
Fi dir = root.child(matched.group(1));
|
||||
if(dir == null) return null; // Mod and folder not found
|
||||
return loadSource(mod, script, dir, validator);
|
||||
}
|
||||
return loadSource(required, script, required.root.child("scripts"), validator);
|
||||
}
|
||||
Matcher matched = directory.matcher(moduleId);
|
||||
if(matched.find()){
|
||||
LoadedMod required = Vars.mods.locateMod(matched.group(1));
|
||||
String script = matched.group(2);
|
||||
if(required == null || root == required.root.child("scripts")){ // Mod not found, or already using a mod
|
||||
Fi dir = root.child(matched.group(1));
|
||||
if(dir == null) return null; // Mod and folder not found
|
||||
return loadSource(mod, script, dir, 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;
|
||||
return new ModuleSource(
|
||||
new InputStreamReader(new ByteArrayInputStream((fillWrapper(module)).getBytes())),
|
||||
|
Loading…
Reference in New Issue
Block a user