mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-23 01:27:35 +01:00
Fix and improve loading of lang files, fixes #121. Bump version number
This commit is contained in:
parent
1b2eb65a10
commit
c600e3e8d2
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<groupId>me.blackvein.quests</groupId>
|
<groupId>me.blackvein.quests</groupId>
|
||||||
<artifactId>quests</artifactId>
|
<artifactId>quests</artifactId>
|
||||||
<version>3.0.9</version>
|
<version>3.1.0</version>
|
||||||
<name>quests</name>
|
<name>quests</name>
|
||||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
@ -131,7 +131,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public boolean load = false;
|
public boolean load = false;
|
||||||
public int killDelay = 0;
|
public int killDelay = 0;
|
||||||
public int totalQuestPoints = 0;
|
public int totalQuestPoints = 0;
|
||||||
public Lang lang;
|
public Lang lang = new Lang(this);
|
||||||
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
public HashMap<String, Integer> commands = new HashMap<String, Integer>();
|
||||||
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
public HashMap<String, Integer> adminCommands = new HashMap<String, Integer>();
|
||||||
private static Quests instance = null;
|
private static Quests instance = null;
|
||||||
@ -161,15 +161,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
saveResource("events.yml", false);
|
saveResource("events.yml", false);
|
||||||
saveResource("data.yml", false);
|
saveResource("data.yml", false);
|
||||||
|
|
||||||
// Save/load lang
|
|
||||||
defaultLangFile();
|
|
||||||
|
|
||||||
// Load files
|
// Load files
|
||||||
loadConfig();
|
loadConfig();
|
||||||
loadModules();
|
loadModules();
|
||||||
loadData();
|
loadData();
|
||||||
loadCommands();
|
loadCommands();
|
||||||
|
|
||||||
|
// Save/load lang
|
||||||
|
defaultLangFile();
|
||||||
|
|
||||||
// Save config with any new options
|
// Save config with any new options
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
@ -182,7 +182,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void defaultLangFile() {
|
private void defaultLangFile() {
|
||||||
lang = new Lang(this);
|
|
||||||
lang.initPhrases();
|
lang.initPhrases();
|
||||||
if (new File(this.getDataFolder(), File.separator + "lang" + File.separator + "en.yml").exists() == false) {
|
if (new File(this.getDataFolder(), File.separator + "lang" + File.separator + "en.yml").exists() == false) {
|
||||||
getLogger().info("Translation data not found, writing defaults to file.");
|
getLogger().info("Translation data not found, writing defaults to file.");
|
||||||
@ -398,23 +397,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
killDelay = config.getInt("kill-delay", 600);
|
killDelay = config.getInt("kill-delay", 600);
|
||||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||||
convertData = config.getBoolean("convert-data-on-startup", false);
|
convertData = config.getBoolean("convert-data-on-startup", false);
|
||||||
if (config.contains("language")) {
|
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
|
||||||
Lang.lang = config.getString("language");
|
maxQuests = config.getInt("max-quests", maxQuests);
|
||||||
} else {
|
|
||||||
config.set("language", "en");
|
|
||||||
}
|
|
||||||
if (config.contains("ignore-locked-quests")) {
|
|
||||||
ignoreLockedQuests = config.getBoolean("ignore-locked-quests");
|
|
||||||
} else {
|
|
||||||
config.set("ignore-locked-quests", false);
|
|
||||||
}
|
|
||||||
if (config.contains("max-quests")) {
|
|
||||||
maxQuests = config.getInt("max-quests");
|
|
||||||
} else {
|
|
||||||
config.set("max-quests", maxQuests);
|
|
||||||
}
|
|
||||||
for (String s : config.getStringList("quester-blacklist")) {
|
for (String s : config.getStringList("quester-blacklist")) {
|
||||||
if (!s.equals("UUID")) {
|
if (!s.equalsIgnoreCase("UUID")) {
|
||||||
questerBlacklist.add(s);
|
questerBlacklist.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,6 +992,7 @@ public class Lang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loadLang() {
|
public void loadLang() {
|
||||||
|
System.out.println("lang reads = " + lang);
|
||||||
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + lang + ".yml");
|
File langFile = new File(plugin.getDataFolder(), File.separator + "lang" + File.separator + lang + ".yml");
|
||||||
boolean newLangs = false;
|
boolean newLangs = false;
|
||||||
if (langFile.exists()) {
|
if (langFile.exists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user