+ * If false then numbers will be used instead.
+ */
+ @Getter
+ private String requirementColor;
+
+ /**
+ * Create new numbers options.
+ *
+ * @param plugin EcoEnchants.
+ */
+ public RequirementsOptions(@NotNull final EcoPlugin plugin) {
+ super(plugin);
+ }
+
+ /**
+ * Update the options.
+ */
+ public void update() {
+ requirementColor = this.getPlugin().getLangYml().getString("missing-requirements-format", false);
+ }
+}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java
index ab70b6b3..acc2a2cb 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java
@@ -6,6 +6,8 @@ import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
+import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
+import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirements;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import com.willfp.ecoenchants.enchantments.util.Watcher;
import lombok.AccessLevel;
@@ -17,6 +19,7 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.Permission;
@@ -26,10 +29,13 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.UUID;
import java.util.stream.Collectors;
@SuppressWarnings({"deprecation", "RedundantSuppression"})
@@ -146,6 +152,22 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
*/
private final List
+ * Only for internal use, requirements are automatically added in the constructor.
+ *
+ * @param req The {@link EnchantmentRequirement} to add.
+ */
+ public static void addNewRequirement(@NotNull final EnchantmentRequirement req) {
+ BY_ID.inverse().remove(req);
+ BY_ID.put(req.getId(), req);
+ }
+
+ /**
+ * Remove {@link EnchantmentRequirement} from EcoEnchants.
+ *
+ * @param req The {@link EnchantmentRequirement} to remove.
+ */
+ public static void removeRequirement(@NotNull final EnchantmentRequirement req) {
+ BY_ID.inverse().remove(req);
+ }
+}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java
new file mode 100644
index 00000000..671833d0
--- /dev/null
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/requirements/requirements/RequirementHasPermission.java
@@ -0,0 +1,23 @@
+package com.willfp.ecoenchants.enchantments.meta.requirements.requirements;
+
+import com.willfp.ecoenchants.enchantments.meta.requirements.EnchantmentRequirement;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class RequirementHasPermission extends EnchantmentRequirement {
+ /**
+ * Create new requirement.
+ */
+ public RequirementHasPermission() {
+ super("has-permission");
+ }
+
+ @Override
+ public boolean doesPlayerMeet(@NotNull final Player player,
+ @NotNull final List