mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-08 09:17:48 +01:00
We have to copy over all locale files before updating active ones.
This commit is contained in:
parent
0439d5eeda
commit
163af81253
@ -2,11 +2,19 @@ package com.gamingmesh.jobs.config;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLClassLoader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.container.LocaleReader;
|
import com.gamingmesh.jobs.container.LocaleReader;
|
||||||
|
|
||||||
@ -21,7 +29,7 @@ public class LanguageManager {
|
|||||||
return languages;
|
return languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** public static List<String> getClassesFromPackage(String pckgname, String cleaner) throws ClassNotFoundException {
|
public static List<String> getClassesFromPackage(String pckgname, String cleaner) throws ClassNotFoundException {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) {
|
for (URL jarURL : ((URLClassLoader) Jobs.class.getClassLoader()).getURLs()) {
|
||||||
@ -64,7 +72,7 @@ public class LanguageManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return listOfCommands;
|
return listOfCommands;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to load the language file configuration
|
* Method to load the language file configuration
|
||||||
@ -72,12 +80,20 @@ public class LanguageManager {
|
|||||||
* loads from Jobs/locale/messages_en.yml
|
* loads from Jobs/locale/messages_en.yml
|
||||||
*/
|
*/
|
||||||
synchronized void load() {
|
synchronized void load() {
|
||||||
|
|
||||||
|
// This should be present to copy over default locale files into locale folder if file doesn't exist. Grabs all files from plugin file.
|
||||||
languages = new ArrayList<>();
|
languages = new ArrayList<>();
|
||||||
/** try {
|
try {
|
||||||
languages.addAll(getClassesFromPackage("locale", "messages_"));
|
languages.addAll(getClassesFromPackage("locale", "messages_"));
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
}
|
||||||
|
for (Iterator<String> e1 = this.languages.iterator(); e1.hasNext();) {
|
||||||
|
String lang = e1.next();
|
||||||
|
YmlMaker langFile = new YmlMaker(Jobs.getInstance(), "locale" + File.separator + "messages_" + lang + ".yml");
|
||||||
|
langFile.saveDefaultConfig();
|
||||||
|
}
|
||||||
|
//Up to here.
|
||||||
|
|
||||||
String ls = Jobs.getGCManager().localeString;
|
String ls = Jobs.getGCManager().localeString;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user