Solved Modify only 1 line of item lore.

Discussion in 'Spigot Plugin Development' started by DeeCaaD, May 31, 2016.

Thread Status:
Not open for further replies.
  1. So how could I modify only 1 line of item lore?
    I already have method to get current line, but I don't know how to modify only that specified line.
    I don't know if this is dumb question which is simple to solve, but I haven't just figure it.

    - DeeCaaD
     
  2. You can get the lore as a list. And you can set the lore with a list. So you get the lore. Set the value for the index that you want and then you set that list as the lore for that item. Just do a quick Google search for setting lore.
     
  3. public void methode(int indexOfLine, String newText)..
    ArrayList<String> lore = meta.getLore(); //asuming ItemMeta "meta" to be a attribute of the class
    lore.set(indexOfLine, newText);
    //then set the lore to the item

    It could look like that. So basicly, it's what bram0101 said :p
     
    #3 Drayke, May 31, 2016
    Last edited: May 31, 2016
  4. Basically, but I didn't spoon feed. Even though it's not fun to not get spoon fed when you're not that great. It is way better to not spoon feed because you learn better by getting told how it works in text and you actually having to write code. Especially for something this easy that basic java developers should know out of their heads how to do it.
     
  5. Already tried that even before I created this thread. Didn't do nothing.
     
  6. The why didn't you post the non working code? That makes things way easier
     
  7. Learn how to use lists. It is an extremely basic and important skill.
     
  8. Forget to put this solved. Problem wasn't in setting specified line of lore. It was before that... I think I have been pretty tired when I posted this thread.
     
Thread Status:
Not open for further replies.