Hello, I have made a little plugin what can change the Lore on a item.. and I want to make it count up everyime you click in the Air This is the Lore: "- 0x clicked"
Use PlayerInteractEvent to get when a player clicks the air. Then see if the player's item in their hand is the item you want to do this to. Then change the item's lore.
That's what I have.. but how do I get the int in the lore then count it up.. and then setting the lore with the new Int
If this is the Lore: String lore = "- 0x clicked"; Remove the random stringy bits: lore.replace("- ", ""); lore.replace("x clicked", ""); Now lore is just the number, so convert it to an Integer: int num = Integer.parseInt(lore); Then add 1: num++; Then re-add the stringy bits: lore = "- " + num + "x clicked"; Then replace the item's lore with the new lore.