testing for lore

Discussion in 'Plugin Development' started by thechrisanator, Apr 15, 2017.

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

    thechrisanator

    I want to try to test for the lore of an item, but it wont work...
    No matter what the lore is, the code proceeds.

    Code:
                                if(handmeta.hasLore()) {
                                    if(handmeta.getLore().equals(ChatColor.translateAlternateColorCodes('&', getConfig().getString("lore")))); {
    also, how would I make it so it would check for multiple lines of lore?
    ex:
    lore: 1
    lore: 2
    lore: 3
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    thechrisanator

    @timtower so how would I incorporate that into my code?
    if(handmeta.lore.contains(ChatColor.translateAlternateColorCodes('&', getConfig().getString("lore"))) {
    ?
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    thechrisanator

    How would I make it so that more than one line of lore can be put into an item via config?
     
  6. Offline

    Caderape2

    @thechrisanator
    - Create an arraylist
    - add lines
    - setLore(ArrayList)

    A lore it's a List of String. you can't compare it to a string. If you have one line, that will work. But not more
     
  7. Offline

    thechrisanator

    So then how would I compare an array to an array? getArray("lore")?
     
  8. Offline

    MCMastery

    No, getStringList.... im pretty sure thats a thing
     
  9. The problem was, that a lore can contain multiple lines, so they put it in a list... You were checking: if list equals string, wich will always return false...


    Verzonden vanaf mijn iPhone met Tapatalk
     
  10. Offline

    thechrisanator

    @Banjer_HD When it was in my plugin, it would actually always return true...
    return true for EVERY lore that is, haha
     
Thread Status:
Not open for further replies.

Share This Page