Solved Get an Int from lore

Discussion in 'Plugin Development' started by user_91277742, Oct 6, 2018.

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

    user_91277742

    hello there!, So.. i just want to know, how can i get an int from the lore of an custom item.
    Example... "Uses: 6"
     
  2. Offline

    MrGeneralQ

    On thé itemStack

    ItemMeta meta = someItemstack.getMeta();
    lore = meta.getLore()

    Verstuurd vanaf mijn ONEPLUS A3003 met Tapatalk
     
  3. Offline

    user_91277742

    But... how can i get the number in the lore?
     
  4. Offline

    Reflxction

    Possibly loop through the lines, use a regex pattern to get the number from the string. Check that out: https://stackoverflow.com/a/2367418
    m.group() will give you a number string (like "4"), simple parse it with Integer#parseInt() or whatever wrapped class you want

    Sent from my TRT-L21A using Tapatalk
     
  5. Offline

    user_91277742

    thanks to all <3
     
Thread Status:
Not open for further replies.

Share This Page