Support 1.14 Minecraft Barrels for Aging

This commit is contained in:
Sn0wStorm
2019-08-17 18:53:06 +02:00
parent a95437cdf1
commit 67ab8e7de3
15 changed files with 324 additions and 121 deletions
@@ -152,11 +152,20 @@ public class ConfigUpdater {
oldMat = false;
}
if (fromVersion.equals("1.7")) {
if (de) {
update17de();
} else {
update17en();
}
fromVersion = "1.8";
}
if (P.use1_13 && oldMat) {
updateMaterials(true);
}
if (!fromVersion.equals("1.7")) {
if (!fromVersion.equals("1.8")) {
P.p.log(P.p.languageReader.get("Error_ConfigUpdate", fromVersion));
return;
}
@@ -1108,6 +1117,60 @@ public class ConfigUpdater {
}
}
// Update de from 1.7 to 1.8
private void update17de() {
updateVersion("1.8");
int index = indexOfStart("openLargeBarrelEverywhere");
if (index == -1) {
index = indexOfStart("colorInBrewer");
if (index == -1) {
index = indexOfStart("colorInBarrels");
if (index == -1) {
index = indexOfStart("hangoverDays");
if (index == -1) {
index = indexOfStart("language");
}
}
}
}
String[] lines = {"",
"# Wie viele Brewery Getränke in die Minecraft Fässer getan werden können [6]",
"maxBrewsInMCBarrels: 6"};
if (index == 0) {
appendLines(lines);
} else {
addLines(index + 1, lines);
}
}
// Update en from 1.7 to 1.8
private void update17en() {
updateVersion("1.8");
int index = indexOfStart("openLargeBarrelEverywhere");
if (index == -1) {
index = indexOfStart("colorInBrewer");
if (index == -1) {
index = indexOfStart("colorInBarrels");
if (index == -1) {
index = indexOfStart("hangoverDays");
if (index == -1) {
index = indexOfStart("language");
}
}
}
}
String[] lines = {"",
"# How many Brewery drinks can be put into the Minecraft barrels [6]",
"maxBrewsInMCBarrels: 6"};
if (index == 0) {
appendLines(lines);
} else {
addLines(index + 1, lines);
}
}
// Update all Materials to Minecraft 1.13
private void updateMaterials(boolean toMC113) {
int index;
@@ -3,6 +3,7 @@ package com.dre.brewery.filedata;
import java.io.File;
import com.dre.brewery.MCBarrel;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@@ -60,6 +61,7 @@ public class DataSave extends BukkitRunnable {
FileConfiguration configFile = new YamlConfiguration();
configFile.set("installTime", Brew.installTime);
configFile.set("MCBarrelTime", MCBarrel.mcBarrelTime);
if (!Brew.potions.isEmpty()) {
Brew.save(configFile.createSection("Brew"));