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

Method getLine

src/redempt/redlib/itemutils/LoreStats.java:53–76  ·  view source on GitHub ↗
(ItemStack item, LorePlaceholder placeholder, String name)

Source from the content-addressed store, hash-verified

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

Callers 2

getStatMethod · 0.95
setMethod · 0.95

Calls 7

getLoreMethod · 0.80
getPosStartMethod · 0.80
getPosFromEndMethod · 0.80
getMethod · 0.65
getLineMethod · 0.45
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected