diff --git a/src/main/java/ch/njol/skript/ScriptLoader.java b/src/main/java/ch/njol/skript/ScriptLoader.java index f5a2842cebf..d8dd1316458 100644 --- a/src/main/java/ch/njol/skript/ScriptLoader.java +++ b/src/main/java/ch/njol/skript/ScriptLoader.java @@ -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 commands = new ArrayList<>(); List events = new ArrayList<>(); @@ -879,17 +879,20 @@ public static List loadStructures(File directory) { File[] files = directory.listFiles(scriptFilter); Arrays.sort(files); + List loadedDirectories = new ArrayList<>(files.length); List 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; } /**