(ItemStack item, LorePlaceholder placeholder, String name)
| 51 | } |
| 52 | |
| 53 | private int getLine(ItemStack item, LorePlaceholder placeholder, String name) { |
| 54 | if (placeholder == null) { |
| 55 | throw new IllegalArgumentException("Placeholder '" + name + "' has not been registered"); |
| 56 | } |
| 57 | List<String> lore = item.getItemMeta().getLore(); |
| 58 | int line = placeholder.getLine(); |
| 59 | if (!fixedLore) { |
| 60 | String loreLine = lines.get(placeholder.getLine()); |
| 61 | String start = loreLine.substring(0, placeholder.getPosStart()); |
| 62 | String end = loreLine.substring(loreLine.length() - placeholder.getPosFromEnd()); |
| 63 | for (int i = 0; i < lore.size(); i++) { |
| 64 | String str = lore.get(i); |
| 65 | if (str.startsWith(start) && str.endsWith(end)) { |
| 66 | line = i; |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | line = -1; |
| 71 | } |
| 72 | if (line >= lore.size()) { |
| 73 | return -1; |
| 74 | } |
| 75 | return line; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Gets a stat in String form from the lore of an item |
no test coverage detected