diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java index 0fe6c194..911780cb 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java @@ -245,10 +245,9 @@ public void reloadLang() { private @NotNull List getAvailableTranslations() { try (final JarFile pluginJar = new JarFile(getFile())) { - Files.createDirectories(new File(getDataFolder(), "/lang").toPath()); final Pattern langPattern = Pattern.compile("([a-z]{1,3}_[a-z]{1,3})(\\.yml)", Pattern.CASE_INSENSITIVE); - final File[] langDirFiles = new File(getDataFolder() + "/lang").listFiles(); - return Stream.concat(pluginJar.stream().map(ZipEntry::getName), Arrays.stream(langDirFiles).map(File::getName)) + final File langFolder = new File(getDataFolder(), "/lang"); + return (langFolder.exists() ? Arrays.stream(langFolder.listFiles()).map(File::getName) : pluginJar.stream().map(ZipEntry::getName)) .map(langPattern::matcher) .filter(Matcher::find) .map(matcher -> matcher.group(1)) diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java index 22a51e0b..ed36d707 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java @@ -253,10 +253,9 @@ public void reloadLang() { private @NotNull List getAvailableTranslations() { try (final JarFile pluginJar = new JarFile(getFile())) { - Files.createDirectories(new File(getDataFolder(), "/lang").toPath()); final Pattern langPattern = Pattern.compile("([a-z]{1,3}_[a-z]{1,3})(\\.yml)", Pattern.CASE_INSENSITIVE); - final File[] langDirFiles = new File(getDataFolder() + "/lang").listFiles(); - return Stream.concat(pluginJar.stream().map(ZipEntry::getName), Arrays.stream(langDirFiles).map(File::getName)) + final File langFolder = new File(getDataFolder(), "/lang"); + return (langFolder.exists() ? Arrays.stream(langFolder.listFiles()).map(File::getName) : pluginJar.stream().map(ZipEntry::getName)) .map(langPattern::matcher) .filter(Matcher::find) .map(matcher -> matcher.group(1))