Own Minecraft Enchantments

Discussion in 'Plugin Development' started by 1BlauNitrox, Oct 31, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    1BlauNitrox

    Good morgning everybody,
    I want to code an spigot plugin which includes own Customenchants, but I`m not sure how I should do this. In the end it have to manage to following things:
    - if you fight oder break blocks the enchantments have to aktive. For example an enchanment called shadow must give the player you hit blindness.
    - Methodes to get the level of a special enchantment on an item
    - Methodes to check if an items have a certain enchantment
    - Methodes to upgrade enchantments. For example you have a Book with a certain enchantment and a sword with the same enchantment on the same level you must be able to combinate these items in an normal anvil or in a self coded anvil. In the end you should lose your book but you have a sword with the enchantment on a higher level.
    I hope someone have an idea.
     
  2. Offline

    w0lves

    I think an easy way of doing that could be just playing with the lore.

    When u want to add the custom enchant, just add a new string to the core with "Shadow I", and when u hit someone check if on the lore of the item is this string.

    To upgrade enchantments just do the same. Check if the item lore has already the enchant "Shadow I", and then replace it by "Shadow II".

    About the anvil, you could use PrepareAnvilEvent, check if there are two items (first one the sword with "Shadow I", second one the book with "Shadow I), and then set on the third spot the sword with "Swadow II". Then when he click it just remove the items on the first and second spot and it will be done.
     
  3. Offline

    1BlauNitrox

    Thank you
     
  4. Offline

    KarimAKL

    @1BlauNitrox Enchantment is an abstract class, so you might be able to extend it, and then create your own enchantment.
     
Thread Status:
Not open for further replies.

Share This Page