diff --git a/Register-Enchantments.md b/Register-Enchantments.md index 47395a7..65af9a7 100644 --- a/Register-Enchantments.md +++ b/Register-Enchantments.md @@ -3,17 +3,17 @@ Registering your enchantment allow Custom Anvil to use your enchantment. To register your enchantment, you need into a `CAEnchantment` instance and then register it. \ This is so Custom Anvil know how to handle action with your enchantment like adding/removing and getting level of it from an item. -## Create the Custom Anvil enchantment +# Creating a Custom Anvil enchantment -### If you were able to register your enchantment to the bukkit registry. +## If you were able to register your enchantment to the bukkit registry. Then you should use or extend `CABukkitEnchantment` ```java CAEnchantment enchantment = new CABukkitEnchantment(bukkitEnchant); ``` -### If your enchantment is not registered into the bukkit registry -For example if you store via persistent data: +## If your enchantment is not registered into the bukkit registry +For example, if you store via persistent data: Then you should preferably create a class extending `CAEnchantmentBase` and implement the required functions: * `getLevel`: To get the enchantment level using item and item meta. @@ -33,7 +33,12 @@ You also need 3 objects for the constructor:

You can also directly implement `CAEnchantment`, but it is not recommended. -## Registering your custom anvil enchantment +## Custom Restriction +You may want to implement AdditionalTestEnchantment to your Custom Anvil Enchantment class. It allows you to add external restriction: +* `isEnchantConflict`: Test if the enchantment is compatible with a provided enchantment map. (key = enchantment, value = level) +* `isItemConflict`: Test if this enchantment is compatible with a provided item (and its enchantments) + +# Registering your custom anvil enchantment ```java EnchantmentApi.registerEnchantment(enchantment); ```