Custom Enchantments

Discussion in 'Spigot Plugin Development' started by TheAjaxProject, Mar 25, 2018.

  1. Hello everyone.

    I'm trying to create a plugin that allows an ItemStack to have a custom enchant.

    Example: Telepathic 1 - When a player mines a block, it adds the block straight into the inventory, instead of them having to pick it up.

    Example 2: AutoSmelt - When a player mines a block which is an ore (lets say iron) the block will drop iron instead of the ore.

    Does anyone know how to implement this? I've heard that I'll need to extend the Enchantment class but I can't find any documentation or tutorial that shows this.

    Thank you for reading :)
  2. Instead of relying on enchantments (and ending up using an API) you can use item lores and enumerations.
  3. - You should check out the BlockBreakEvent listener so that you can check when a player mines a block

    - You should check out the ItemStack class so that you can create your own itemstacks with a lores as your "enchantments" as well as to understand how to get certain things from a player's item in hand.

    - Finally, check out the Player class so that you can make a local variable of the player who broke the block and check his item in hand's type as well as if he has the lore of the "enchantment".

    Obviously you will use more classes but these are the three I can suggest using that are best for writing pseudo-code out of.