Dont break pufferfish.yml

This commit is contained in:
BillyGalbreath
2022-06-14 06:51:42 -05:00
parent 8e6f46b237
commit 672c9f09e2

View File

@@ -7,7 +7,7 @@ This patch's implementation has been removed in favor of Pufferfish's entity-tim
The config remains for migration purposes.
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index a125abc75ed2bbd905c8fdec442416a45264f531..e76c7e04274d8e94a3e5d6576e42364b2320a9ee 100644
index a125abc75ed2bbd905c8fdec442416a45264f531..09f826a9d46b6474ef0ab26611e9a305fe19ed9b 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -121,6 +121,22 @@ public class PufferfishConfig {
@@ -16,7 +16,7 @@ index a125abc75ed2bbd905c8fdec442416a45264f531..e76c7e04274d8e94a3e5d6576e42364b
}
+
+ // Purpur start
+ public static int getInt(String key, int def) {
+ public static int getRawInt(String key, int def) {
+ return config.getInt(key, def);
+ }
+ public static void setInt(String key, int value) {
@@ -34,7 +34,7 @@ index a125abc75ed2bbd905c8fdec442416a45264f531..e76c7e04274d8e94a3e5d6576e42364b
private static boolean getBoolean(String key, boolean defaultValue, String... comment) {
return getBoolean(key, null, defaultValue, comment);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 10be99da087706094e93144252ea666dc1238979..ed58cb6d17e1f79a8d0cf05be1921a51795c0762 100644
index 10be99da087706094e93144252ea666dc1238979..79afd91b958d111468901d49fe85565277839891 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -292,6 +292,39 @@ public class PurpurWorldConfig {
@@ -68,7 +68,7 @@ index 10be99da087706094e93144252ea666dc1238979..ed58cb6d17e1f79a8d0cf05be1921a51
+ private void migrateProjectileDespawnRateSettings(EntityType<?> type) {
+ String pufferName = "entity_timeouts." + type.id.toUpperCase(Locale.ROOT);
+ int value = getInt("gameplay-mechanics.projectile-despawn-rates." + type.id, -1);
+ if (value != -1 && PufferfishConfig.getInt(pufferName, -1) == -1) {
+ if (value != -1 && PufferfishConfig.getRawInt(pufferName, -1) == -1) {
+ PufferfishConfig.setInt(pufferName, value);
+ type.ttl = value;
+ }