mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Rework populator seed migration from tuinity config
This commit is contained in:
@@ -164,7 +164,7 @@ index 862553e98a7237d39a26036c615b9cbd001bd3bf..d11b463548b847382a22fdf50496b186
|
||||
this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..32f44983aaec838960e6435580ee261cfa266b53
|
||||
index 0000000000000000000000000000000000000000..5bc7d1d72847fc200a5bcd19f083e45805546aeb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -0,0 +1,130 @@
|
||||
@@ -223,8 +223,8 @@ index 0000000000000000000000000000000000000000..32f44983aaec838960e6435580ee261c
|
||||
+ commands = new HashMap<>();
|
||||
+ commands.put("purpur", new PurpurCommand("purpur"));
|
||||
+
|
||||
+ version = getInt("config-version", 15);
|
||||
+ set("config-version", 15);
|
||||
+ version = getInt("config-version", 16);
|
||||
+ set("config-version", 16);
|
||||
+
|
||||
+ readConfig(PurpurConfig.class, null);
|
||||
+ }
|
||||
|
||||
@@ -39,7 +39,7 @@ index a7a7e6cd87270e64a92448f03f8b0b0c7e375ec7..9fb19162c0e436122087d03d37b502a1
|
||||
try {
|
||||
region.setCurrentlyGenerating(supplier3);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 6629addad421042fae15d1b70c0a8d51ecf5f3e2..9c766351673b66f02db3b88ef7b1651e63779307 100644
|
||||
index 6629addad421042fae15d1b70c0a8d51ecf5f3e2..de47ddf70c993a1f8600062005eab6dd44475b56 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -2242,4 +2242,20 @@ public class PurpurWorldConfig {
|
||||
@@ -49,17 +49,17 @@ index 6629addad421042fae15d1b70c0a8d51ecf5f3e2..9c766351673b66f02db3b88ef7b1651e
|
||||
+
|
||||
+ public boolean randomPopulatorSeed = false;
|
||||
+ private void seedSettings() {
|
||||
+ randomPopulatorSeed = getBoolean("seed.random-populator-seed", randomPopulatorSeed);
|
||||
+ if (!randomPopulatorSeed) {
|
||||
+ ConfigurationSection defaultTuinity = TuinityConfig.config.getConfigurationSection("world-settings.default");
|
||||
+ ConfigurationSection currentTuinity = TuinityConfig.config.getConfigurationSection(level.tuinityConfig.configPath);
|
||||
+ if (currentTuinity.getString("worldgen.seeds.populator", defaultTuinity.getString("worldgen.seeds.populator", "default")).equalsIgnoreCase("random")) {
|
||||
+ randomPopulatorSeed = true;
|
||||
+ if (PurpurConfig.version < 16) {
|
||||
+ try {
|
||||
+ java.lang.reflect.Method method = TuinityConfig.WorldConfig.class.getDeclaredMethod("getString", String.class, String.class);
|
||||
+ method.setAccessible(true);
|
||||
+ String def = (String) method.invoke(level.tuinityConfig, "worldgen.seeds.populator", "default");
|
||||
+ if (def.equalsIgnoreCase("random")) {
|
||||
+ set("seed.random-populator-seed", true);
|
||||
+ }
|
||||
+ } catch (NoSuchMethodException | java.lang.reflect.InvocationTargetException | IllegalAccessException ignore) {
|
||||
+ }
|
||||
+ defaultTuinity.set("worldgen.seeds.populator", null);
|
||||
+ currentTuinity.set("worldgen.seeds.populator", null);
|
||||
+ }
|
||||
+
|
||||
+ set("seed.random-populator-seed", randomPopulatorSeed);
|
||||
+ randomPopulatorSeed = getBoolean("seed.random-populator-seed", randomPopulatorSeed);
|
||||
+ }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user