Move lang updating to updateLang() in the main class
This commit is contained in:
@@ -250,9 +250,21 @@ public class PlayerVaults extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
|
||||
for(Lang item:Lang.values()) {
|
||||
if (conf.getString(item.getPath()) == null) {
|
||||
conf.set(item.getPath(), item.getDefault());
|
||||
}
|
||||
}
|
||||
Lang.setFile(conf);
|
||||
PlayerVaults.LANG = conf;
|
||||
PlayerVaults.LANG_FILE = lang;
|
||||
try {
|
||||
conf.save(getLangFile());
|
||||
} catch(IOException e) {
|
||||
log.log(Level.WARNING, "PlayerVaults: Failed to save lang.yml.");
|
||||
log.log(Level.WARNING, "PlayerVaults: Report this stack trace to drtshock and gomeow.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -22,22 +20,6 @@ public class Updater extends PlayerVaults {
|
||||
|
||||
SortedMap<String, String> lang = new TreeMap<String, String>();
|
||||
|
||||
public Updater() {
|
||||
YamlConfiguration langConf = super.getLang();
|
||||
for(Lang item:Lang.values()) {
|
||||
if (langConf.getString(item.getPath()) == null) {
|
||||
langConf.set(item.getPath(), item.getDefault());
|
||||
}
|
||||
}
|
||||
try {
|
||||
langConf.save(super.getLangFile());
|
||||
} catch(IOException e) {
|
||||
log.log(Level.WARNING, "PlayerVaults: Failed to save lang.yml.");
|
||||
log.log(Level.WARNING, "PlayerVaults: Report this stack trace to drtshock and gomeow.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether or not there is a new update.
|
||||
* @param currentVersion The current running version.
|
||||
|
||||
Reference in New Issue
Block a user