Skip to content

Commit

Permalink
first language cache loaded creates lang folder if doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Dec 31, 2024
1 parent 565d23e commit b9aa6f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.kyori.adventure.text.minimessage.MiniMessage;

import java.io.File;
import java.nio.file.Files;
import java.util.List;
import java.util.Locale;

Expand All @@ -33,9 +34,9 @@ public LanguageCache(String langString) throws Exception {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
File langYML = new File(plugin.getDataFolder() + "/lang", langString + ".yml");
// Check if the lang folder has already been created
File parent = langYML.getParentFile();
if (!parent.exists() && !parent.mkdir())
AnarchyExploitFixes.prefixedLogger().error("Unable to create lang directory.");
File langFolder = langYML.getParentFile();
if (!langFolder.exists())
Files.createDirectories(langFolder.toPath());
// 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/" + langString + ".yml", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.ChatColor;

import java.io.File;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -33,9 +34,9 @@ public LanguageCache(String langString) throws Exception {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
File langYML = new File(plugin.getDataFolder() + "/lang", langString + ".yml");
// Check if the lang folder has already been created
File parent = langYML.getParentFile();
if (!parent.exists() && !parent.mkdir())
AnarchyExploitFixes.prefixedLogger().error("Unable to create lang directory.");
File langFolder = langYML.getParentFile();
if (!langFolder.exists())
Files.createDirectories(langFolder.toPath());
// 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/" + langString + ".yml", false);
Expand Down

0 comments on commit b9aa6f9

Please sign in to comment.