Create a LoreStats from a list of lore lines and a vararg of placeholder names @param lines The lines of lore to load. Placeholders should be surrounded by percent signs. @param placeholders Placeholder names, WITHOUT being surrounded by percent signs
(List<String> lines, String... placeholders)
| 23 | * @param placeholders Placeholder names, WITHOUT being surrounded by percent signs |
| 24 | */ |
| 25 | public LoreStats(List<String> lines, String... placeholders) { |
| 26 | this.lines = lines; |
| 27 | for (String name : placeholders) { |
| 28 | String full = '%' + name + '%'; |
| 29 | for (int i = 0; i < lines.size(); i++) { |
| 30 | String line = lines.get(i); |
| 31 | int posStart = line.indexOf(full); |
| 32 | if (posStart == -1) { |
| 33 | continue; |
| 34 | } |
| 35 | int posFromEnd = line.length() - (posStart + full.length()); |
| 36 | LorePlaceholder placeholder = new LorePlaceholder(name, i, posStart, posFromEnd); |
| 37 | this.placeholders.put(name, placeholder); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * True by default. Set to true if the lore lines on the item will always show up at the same |