Skip to content

Commit

Permalink
Make scripts in directories load before rest (SkriptLang#4515)
Browse files Browse the repository at this point in the history
  • Loading branch information
TPGamesNL authored Jul 18, 2022
1 parent 7186ed1 commit 715a016
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/ch/njol/skript/ScriptLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ private static ScriptInfo loadScript(@Nullable Config config) {
if (config == null) { // Something bad happened, hopefully got logged to console
return new ScriptInfo();
}

// When something is parsed, it goes there to be loaded later
List<ScriptCommand> commands = new ArrayList<>();
List<ParsedEventData> events = new ArrayList<>();
Expand Down Expand Up @@ -879,17 +879,20 @@ public static List<Config> loadStructures(File directory) {
File[] files = directory.listFiles(scriptFilter);
Arrays.sort(files);

List<Config> loadedDirectories = new ArrayList<>(files.length);
List<Config> loadedFiles = new ArrayList<>(files.length);
for (File file : files) {
if (file.isDirectory()) {
loadedFiles.addAll(loadStructures(file));
loadedDirectories.addAll(loadStructures(file));
} else {
Config cfg = loadStructure(file);
if (cfg != null)
loadedFiles.add(cfg);
}
}
return loadedFiles;

loadedDirectories.addAll(loadedFiles);
return loadedDirectories;
}

/**
Expand Down

0 comments on commit 715a016

Please sign in to comment.