Better EnchantAPI?

Discussion in 'Spigot Plugin Development' started by Futurize, May 3, 2017.

  1. Hey guys! Currently, I have began working on a custom enchantment plugin using this API It works exactly the way I want it to, except for the weird placeholder that shows up when placing it into the enchantment table. Does anyone have an API for custom enchants with most of the same features as this but without the placeholder thing? Thanks!
  2. You can always make your own using the Bukkit enchantment API.
  3. Yeah but does that allow you to get them through an enchanting table?
  4. Only 2 backsides:
    - Requires lores.
    - Requires you to reflect the field which allows registration in Enchantment to be set to true then call Enchantments#stopRegistrations or whatever it's called.
  5. Any tutorials anywhere on how to do this? Don't quite have a grasp on how to do this. Also, I am looking for something that allows you to combine them in anvils to get higher levels.
    Extend it.
    Reflect this field to true(It's changed when bukkit is done loading):
    Code (Java):
    try {
        Field field = Enchantment.class.getDeclaredField("acceptingNew");
        field.set(null, true);
    } catch (Exception ex) {ex.printStackTrace();}
    Then register using Enchantment#registerEnchantment
    Once you're done, let it load them by calling Enchantment#stopAcceptingRegistrations
  7. Didn't try it out yet but someone told me that this will not work for anvils/enchanting tables.

    What do I do from here? I reflected it to true in the onEnable().
    Code (Text):
    public class Test extends Enchantment {

        public Test(int id) {

        public boolean canEnchantItem(ItemStack item) {
            return false;

        public boolean conflictsWith(Enchantment enchant) {
            return false;

        public EnchantmentTarget getItemTarget() {
            return null;

        public int getMaxLevel() {
            return 2;

        public String getName() {
            return "test";

        public int getStartLevel() {
            return 1;
  8. this wont work at all