From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 13 Oct 2020 20:04:33 -0500
Subject: [PATCH] Allow infinite and mending enchantments together


diff --git a/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java b/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
index 408cfa460920f74e0394ab27101ecb12cceb9c43..3d4e34f7070a48c436284ba7744a94aeacbb7651 100644
--- a/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
+++ b/src/main/java/net/minecraft/server/EnchantmentInfiniteArrows.java
@@ -23,6 +23,6 @@ public class EnchantmentInfiniteArrows extends Enchantment {
 
     @Override
     public boolean a(Enchantment enchantment) {
-        return enchantment instanceof EnchantmentMending ? false : super.a(enchantment);
+        return enchantment instanceof EnchantmentMending ? net.pl3x.purpur.PurpurConfig.allowInfinityMending : super.a(enchantment); // Purpur
     }
 }
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index a5febd7671ae1818edb18955d5e8176303c92c93..a20d7ac486a915fae2c6c7d42aa07d44f42438db 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -197,6 +197,16 @@ public class PurpurConfig {
         cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
     }
 
+    public static boolean allowInfinityMending = false;
+    private static void enchantmentSettings() {
+        if (version < 5) {
+            boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
+            set("settings.enchantment.allow-infinity-and-mending-together", oldValue);
+            set("settings.enchantment.allow-infinite-and-mending-together", null);
+        }
+        allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
+    }
+
     public static boolean endermanShortHeight = false;
     private static void entitySettings() {
         endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
