Added Parity/Sanity to Scrambling

This commit is contained in:
Sn0wStorm
2019-10-11 18:05:49 +02:00
parent 9bf3268fb4
commit 2121bf5c8a
4 changed files with 15 additions and 5 deletions
+7 -3
View File
@@ -17,6 +17,7 @@ import org.bukkit.potion.PotionType;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
@@ -756,6 +757,9 @@ public class Brew {
} catch (IOException e) {
P.p.errorLog("IO Error while loading Brew");
e.printStackTrace();
} catch (InvalidKeyException e) {
P.p.errorLog("Failed to load Brew, has the data key 'BrewDataSeed' in the data.yml been changed?");
e.printStackTrace();
}
return null;
}
@@ -840,12 +844,12 @@ public class Brew {
}
public static void writeSeed(ConfigurationSection section) {
section.set("seed", saveSeed);
section.set("BrewDataSeed", saveSeed);
}
public static void loadSeed(ConfigurationSection section) {
if (section.contains("seed")) {
saveSeed = section.getLong("seed");
if (section.contains("BrewDataSeed")) {
saveSeed = section.getLong("BrewDataSeed");
} else {
while (saveSeed == 0) {
saveSeed = new SecureRandom().nextLong();