Solved Enchantments help

Discussion in 'Spigot Plugin Development' started by TheWolvesKing, Feb 1, 2020.

  1. I hope this isn't the wrong thread. If it is, I'll move this to the right one.
    By the way, I'm writing a plugin that changes the lore of the item, adding the enchantments that the item has.
    I discovered that using Enchantment#getName() for internal enchantments, Bukkit returns the name that they use in the class, like DAMAGE_ALL instead of Sharpness. So, I use a JSON file to store all those things. It is saved in this way:
    {"id": "{id}", "value": "{value}"},
    //The same for every enchantment

    In Minecraft, there are so many enchantments, so it will take way too long for me.
    Is there anyone who can help? It will be credited to the plugins authors.
    If there are other ways, some help would be appreciated

    Now I have also another issue, regarding custom enchantments. When I register the enchantment at plugin startup, if the server is starting, no problem, but if I reload it, it says "Unable to set already-set enchantment". Any idea?
    #1 TheWolvesKing, Feb 1, 2020
    Last edited: Feb 1, 2020
  2. wait what is it you want? Could you give an example?
    {"id": DAMAGE_ALL, "value": 2}?
  3. No, I forgot to add the meanings of the {id} and {value}.
    {id} is the name that is returned by getName() and value is the name that will be displayed in the lore, like
    {"id": "DAMAGE_ALL", "value": "Sharpness"}
    I forgot a part. in the original post
  4. Just gonna leave this here in case anybody else needs it...

    Attached Files:

  5. Already done? Thank you!
  6. As I said, that isn't a lot of work...
    I'm just gonna say that you probably should use the translation-keys and do a localized version of that (since this only works for english)
  7. Next updates...
    In 2 months the resource will be out (It will include various things), I'll notify you when I'll release it.