Load Scramble Seed key from Config

Remember all used Scramble seeds to unscramble potions
This commit is contained in:
Sn0wStorm
2019-10-18 16:30:03 +02:00
parent 437f521a9b
commit f431c13100
25 changed files with 327 additions and 69 deletions
@@ -54,6 +54,7 @@ public class BConfig {
//Brew
public static boolean colorInBarrels; // color the Lore while in Barrels
public static boolean colorInBrewer; // color the Lore while in Brewer
public static boolean enableEncode;
public static P p = P.p;
@@ -173,9 +174,12 @@ public class BConfig {
homeType = config.getString("homeType", null);
colorInBarrels = config.getBoolean("colorInBarrels", false);
colorInBrewer = config.getBoolean("colorInBrewer", false);
enableEncode = config.getBoolean("enableEncode", false);
openEverywhere = config.getBoolean("openLargeBarrelEverywhere", false);
MCBarrel.maxBrews = config.getInt("maxBrewsInMCBarrels", 6);
Brew.loadSeed(config, file);
// loading recipes
ConfigurationSection configSection = config.getConfigurationSection("recipes");
if (configSection != null) {
+1 -1
View File
@@ -31,7 +31,7 @@ public class BData {
Brew.installTime = data.getLong("installTime", System.currentTimeMillis());
MCBarrel.mcBarrelTime = data.getLong("MCBarrelTime", 0);
Brew.loadSeed(data);
Brew.loadPrevSeeds(data);
// Check if data is the newest version
String version = data.getString("Version", null);
@@ -82,6 +82,31 @@ public class ConfigUpdater {
// ---- Updating Scramble Seed ----
public void setEncodeKey(long key) {
int index = indexOfStart("encodeKey:");
if (index != -1) {
setLine(index, "encodeKey: " + key);
return;
}
// Old key not present
index = indexOfStart("enableEncode:");
if (index == -1) {
index = indexOfStart("# So enable this if you want to make recipe cheating harder");
}
if (index == -1) {
index = indexOfStart("version:");
}
if (index != -1) {
addLines(index + 1, "encodeKey: " + key);
} else {
addLines(1, "encodeKey: " + key);
}
}
// ---- Updating to newer Versions ----
// Update from a specified Config version and language to the newest version
+1 -1
View File
@@ -64,7 +64,7 @@ public class DataSave extends BukkitRunnable {
configFile.set("installTime", Brew.installTime);
configFile.set("MCBarrelTime", MCBarrel.mcBarrelTime);
Brew.writeSeed(configFile);
Brew.writePrevSeeds(configFile);
if (!Brew.legacyPotions.isEmpty()) {
Brew.save(configFile.createSection("Brew"));