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 a9c6b2aee5c87981f783b6004b4ffb048df5657d..03d5a9f923597c07d050465e261efe9a8bc935a6 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -144,6 +144,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 c51cca18eb13a0743d9c7748c58a3669d6178216..4b291b6bd8e74a4affd6a6ea7e1ace50d78ff7eb 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;
