Organized enchant lores

Discussion in 'Plugin Development' started by MattTheBeast, Jul 1, 2017.

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

    MattTheBeast

    So basicly I made custom echants, the enchants are lores and they have diffrent colors depending on the rarity (Green, blue, gold). When I use my methode to enchant a item, it will add lore for the coresponding enchant. The problem is the enchants are unorganized... For example, lets say I get a common enchant, my first line of lore on that item will be green, then if I get a rare enchant the second line will be blue, then lets say I get a other comman il have a item with a lore that looks like this:

    Green
    Blue
    Green

    I wonder is anybody could give me ideas on how to organize the enchants in a order like so:

    Gold
    .. (other gold enchants)
    Blue
    .. (other blue enchants)
    Green
    .. (other green enchants)

    Thanks for helping!
     
  2. Offline

    timtower Administrator Administrator Moderator

    @MattTheBeast How do you check which enchants are on the item? Is this based on strings?
     
  3. Offline

    MattTheBeast

    @timtower

    No I made a custom enchant, so I check for a enchant like any other

    If(item.containsenchant(enchant))
    {...}

    When I add a custom enchant on the item I call a methode that add a lore. I'm trying to get that methode to organize my enchants when it adds a new one.
     
  4. Offline

    Horsey

    Use 3 different lists (green, blue and gold), iterate over all the enchantments and add them to their respective list. Then join all the lores with gold.addAll(green); and so on, and finally set the merged list to the lore.
     
  5. Offline

    MattTheBeast

    Thank you il try this out
     
Thread Status:
Not open for further replies.

Share This Page