Load 1.13 configs in 1.13+ and 1.12 configs in 1.12-

This commit is contained in:
Daniel Saukel 2018-09-21 22:10:07 +02:00
parent 54ebee1dc8
commit f736a6e331
10 changed files with 16 additions and 12 deletions

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Rezepte für Getränke --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Recipes for Potions --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Version de configuration
version: '1.5'
version: '1.6'
# -- Recette pour les boissons --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Versione del config
version: '1.5'
version: '1.6'
# -- Ricette per pozioni --

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Rezepte für Getränke --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Recipes for Potions --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Version de configuration
version: '1.5'
version: '1.6'
# -- Recette pour les boissons --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Versione del config
version: '1.5'
version: '1.6'
# -- Ricette per pozioni --

View File

@ -37,7 +37,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public class P extends JavaPlugin {
public static P p;
public static final String configVersion = "1.5";
public static final String configVersion = "1.6";
public static boolean debug;
public static boolean useUUID;
public static boolean use1_9;
@ -606,7 +606,7 @@ public class P extends JavaPlugin {
if (!cfg.exists()) {
errorLog("No config.yml found, creating default file! You may want to choose a config according to your language!");
errorLog("You can find them in plugins/Brewery/configs/");
InputStream defconf = getResource("config/en/config.yml");
InputStream defconf = getResource("config/" + (use1_13 ? "v13/" : "v12/") + "en/config.yml");
if (defconf == null) {
errorLog("default config file not found, your jarfile may be corrupt. Disabling Brewery!");
return false;
@ -633,7 +633,7 @@ public class P extends JavaPlugin {
for (String l : new String[] {"de", "en", "fr", "it"}) {
File lfold = new File(configs, l);
try {
saveFile(getResource("config/" + l + "/config.yml"), lfold, "config.yml", overwrite);
saveFile(getResource("config/" + (use1_13 ? "v13/" : "v12/") + l + "/config.yml"), lfold, "config.yml", overwrite);
saveFile(getResource("languages/" + l + ".yml"), languages, l + ".yml", false); // Never overwrite languages for now
} catch (IOException e) {
e.printStackTrace();

View File

@ -144,7 +144,11 @@ public class ConfigUpdater {
fromVersion = "1.5";
}
if (!fromVersion.equals("1.5")) {
if (fromVersion.equals("1.5")) {
fromVersion = "1.6";
}
if (!fromVersion.equals("1.6")) {
P.p.log(P.p.languageReader.get("Error_ConfigUpdate", fromVersion));
return;
}