Dedicated directory for locales

This commit is contained in:
Mark Vainomaa 2019-04-30 09:31:33 +03:00
parent 0f2e1ea740
commit 1ca48051ad
2 changed files with 9 additions and 1 deletions

View File

@ -104,7 +104,7 @@ public final class LocaleLoader {
throw new IllegalStateException("Failed to parse locale string '" + Config.getInstance().getLocale() + "'");
}
Path localePath = Paths.get(mcMMO.getMainDirectory() + "locale_" + locale.toString() + ".properties");
Path localePath = Paths.get(mcMMO.getLocalesDirectory() + "locale_" + locale.toString() + ".properties");
if (Files.exists(localePath) && Files.isRegularFile(localePath)) {
try (Reader localeReader = Files.newBufferedReader(localePath)) {
filesystemBundle = new PropertyResourceBundle(localeReader);

View File

@ -79,6 +79,7 @@ public class mcMMO extends JavaPlugin {
/* File Paths */
private static String mainDirectory;
private static String localesDirectory;
private static String flatFileDirectory;
private static String usersFile;
private static String modDirectory;
@ -357,6 +358,10 @@ public class mcMMO extends JavaPlugin {
return mainDirectory;
}
public static String getLocalesDirectory() {
return localesDirectory;
}
public static String getFlatFileDirectory() {
return flatFileDirectory;
}
@ -432,6 +437,7 @@ public class mcMMO extends JavaPlugin {
private void setupFilePaths() {
mcmmo = getFile();
mainDirectory = getDataFolder().getPath() + File.separator;
localesDirectory = mainDirectory + "locales" + File.separator;
flatFileDirectory = mainDirectory + "flatfile" + File.separator;
usersFile = flatFileDirectory + "mcmmo.users";
modDirectory = mainDirectory + "mods" + File.separator;
@ -485,6 +491,8 @@ public class mcMMO extends JavaPlugin {
File currentFlatfilePath = new File(flatFileDirectory);
currentFlatfilePath.mkdirs();
File localesDirectoryPath = new File(localesDirectory);
localesDirectoryPath.mkdirs();
}
private void loadConfigFiles() {