From eaf265c692b761dc28c035c9ed83a0f915cab7fe Mon Sep 17 00:00:00 2001 From: xGinko Date: Tue, 27 Feb 2024 20:16:14 +0100 Subject: [PATCH] fix #178 --- .../me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java | 4 ++-- .../me/moomoo/anarchyexploitfixes/config/LanguageCache.java | 6 +++--- .../me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java | 2 +- .../me/moomoo/anarchyexploitfixes/config/LanguageCache.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java index 093e63b0b..5f14db25c 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java @@ -147,7 +147,7 @@ private void reloadLang() { File langDirectory = new File(getDataFolder() + File.separator + "lang"); Files.createDirectories(langDirectory.toPath()); for (String fileName : getDefaultLanguageFiles()) { - final String localeString = fileName.substring(fileName.lastIndexOf(File.separator) + 1, fileName.lastIndexOf('.')); + final String localeString = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.')); logger.info("Found language file for " + localeString); languageCacheMap.put(localeString, new LanguageCache(localeString)); } @@ -172,7 +172,7 @@ private Set getDefaultLanguageFiles() { try (final JarFile pluginJarFile = new JarFile(this.getFile())) { return pluginJarFile.stream() .map(ZipEntry::getName) - .filter(name -> name.startsWith("lang" + File.separator) && name.endsWith(".yml")) + .filter(name -> name.startsWith("lang/") && name.endsWith(".yml")) .collect(Collectors.toSet()); } catch (IOException e) { logger.severe("Failed getting default lang files! - "+e.getLocalizedMessage()); diff --git a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java index 6fb41c05f..dfbd1a931 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java @@ -30,10 +30,10 @@ public LanguageCache(String locale) throws Exception { File parent = langYML.getParentFile(); if (!parent.exists() && !parent.mkdir()) AnarchyExploitFixes.getLog().severe("Unable to create lang directory."); - // Check if the file already exists and save the one from the plugins resources folder if it does not + // Check if the file already exists and save the one from the plugin's resources folder if it does not if (!langYML.exists()) - plugin.saveResource("lang" + File.separator + locale + ".yml", false); - // Finally load the lang file with configmaster + plugin.saveResource("lang/" + locale + ".yml", false); + // Finally, load the lang file with configmaster this.lang = ConfigFile.loadConfig(langYML); // Commands diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java index 94850cfcf..4f3065150 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/AnarchyExploitFixes.java @@ -172,7 +172,7 @@ private Set getDefaultLanguageFiles() { try (final JarFile pluginJarFile = new JarFile(this.getFile())) { return pluginJarFile.stream() .map(ZipEntry::getName) - .filter(name -> name.startsWith("lang" + File.separator) && name.endsWith(".yml")) + .filter(name -> name.startsWith("lang/") && name.endsWith(".yml")) .collect(Collectors.toSet()); } catch (IOException e) { logger.severe("Failed getting default lang files! - "+e.getLocalizedMessage()); diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java index e1c97547d..a40f8e2b0 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/moomoo/anarchyexploitfixes/config/LanguageCache.java @@ -32,10 +32,10 @@ public LanguageCache(String locale) throws Exception { File parent = langYML.getParentFile(); if (!parent.exists() && !parent.mkdir()) AnarchyExploitFixes.getLog().severe("Unable to create lang directory."); - // Check if the file already exists and save the one from the plugins resources folder if it does not + // Check if the file already exists and save the one from the plugin's resources folder if it does not if (!langYML.exists()) - plugin.saveResource("lang" + File.separator + locale + ".yml", false); - // Finally load the lang file with configmaster + plugin.saveResource("lang/" + locale + ".yml", false); + // Finally, load the lang file with configmaster this.lang = ConfigFile.loadConfig(langYML); // Commands