MCPcopy Create free account
hub / github.com/boxbeam/RedLib / LoreStats

Method LoreStats

src/redempt/redlib/itemutils/LoreStats.java:25–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

indexOfMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected