From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Wed, 2 Dec 2020 14:49:10 -0800
Subject: [PATCH] Config migration: climbing should not bypass cramming
 gamerule


diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index f1088638716b4a02eb3b8541a040229da8a6ea24..70ac948a91c1d4f9cffeac982c505cd1c3908cd3 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -145,6 +145,17 @@ public class PurpurConfig {
         }
     }
 
+    private static void migrateClimbingCrammingFix() {
+        if (PurpurConfig.version < 7) {
+            final boolean climbingCrammingFix = getBoolean("world-settings.default.gameplay-mechanics.fix-climbing-bypassing-cramming-rule", false);
+            set("world-settings.default.gameplay-mechanics.fix-climbing-bypassing-cramming-rule", null);
+            if (climbingCrammingFix) {
+                PaperConfig.config.set("world-settings.default.fix-climbing-bypassing-cramming-rule", true);
+                PaperConfig.saveConfig();
+            }
+        }
+    }
+
     public static String afkBroadcastAway = "§e§o%s is now AFK";
     public static String afkBroadcastBack = "§e§o%s is no longer AFK";
     public static String afkTabListPrefix = "[AFK] ";
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index eb6e752ca3be8fc933eec58f639952990393bb1f..d6f98a1b4bcc44bad7c8e39f31ea61cd7428f071 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -96,6 +96,17 @@ public class PurpurWorldConfig {
         }
     }
 
+    private void migrateClimbingCrammingFix() {
+        if (PurpurConfig.version < 7) {
+            final boolean climbingCrammingFix = PurpurConfig.config.getBoolean("world-settings." + worldName + ".gameplay-mechanics.fix-climbing-bypassing-cramming-rule", false);
+            PurpurConfig.config.set("world-settings." + worldName + ".gameplay-mechanics.fix-climbing-bypassing-cramming-rule", null);
+            if (climbingCrammingFix) {
+                PaperConfig.config.set("world-settings." + worldName + ".fix-climbing-bypassing-cramming-rule", true);
+                PaperConfig.saveConfig();
+            }
+        }
+    }
+
     public boolean armorstandSetNameVisible = false;
     public boolean armorstandFixNametags = false;
     public float armorstandStepHeight = 0.0F;
