This feature aims to allow plugins that depend on the Purpur API to create custom NamespaceKey based enchantments.
Goals
There are a few goals that I want this PR to achieve before it gets merged:
[x] Allow plugins to add custom enchantments with the Bukkit API
[ ] Allow plugins to query and interact with custom enchantments without having to query new APIs (interop with old bukkit enchantments API)
[x] Allow players to apply custom enchantments with the vanilla enchant command (vanilla interop)
[ ] Make sure not to break other custom enchantment plugins
Considerations
Since this feature is supposed to be flexible for a lot of use-cases, there are some things that need to be considered:
[ ] The package where the code resides. Is org.bukkit.enchantments.custom even good enough?Should it be on a Purpur package?
[x] API structure. Should plugins have to implement a separate interface or extend from a Bukkit class? Should our CustomEnchantment class/interface extend/implement any Bukkit class/interface?
[ ] How to show it for clients. Show custom enchantments follow the same layout as regular enchantments?Should this change introduce a way to modify the layout of the enchantments as a configuration setting?
[ ] Anvil support. Does Vanilla even handle custom enchantments well with Anvils?What about books?Can we apply custom enchantments to items with an anvil?What about enchantment merging?
[ ] Exposing enchantments properly. Is this API flexible enough for anyone to use it?What about when enchantments need Listeners to function?
This feature aims to allow plugins that depend on the Purpur API to create custom
NamespaceKey
based enchantments.Goals
There are a few goals that I want this PR to achieve before it gets merged:
Considerations
Since this feature is supposed to be flexible for a lot of use-cases, there are some things that need to be considered:
org.bukkit.enchantments.custom
even good enough? Should it be on a Purpur package?CustomEnchantment
class/interface extend/implement any Bukkit class/interface?