aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
diff options
context:
space:
mode:
authorUpFault <76474308+UpFault@users.noreply.github.com>2024-07-18 03:07:33 -0500
committerGitHub <noreply@github.com>2024-07-18 16:07:33 +0800
commitcceaa38e7c1783d0446a50dbb09e42b8287e38d1 (patch)
tree5a4f94c94a8822bf262e5b465c384dd11686aac2 /src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
parent50b7a167253683d1526ac16a46e36adf1f5300d5 (diff)
downloadSkyblocker-cceaa38e7c1783d0446a50dbb09e42b8287e38d1.tar.gz
Skyblocker-cceaa38e7c1783d0446a50dbb09e42b8287e38d1.tar.bz2
Skyblocker-cceaa38e7c1783d0446a50dbb09e42b8287e38d1.zip
EssenceShopPrice feature (#737)
Added EssenceShopPrice Feature, moved concatenate methods from ChocolateFactorySolver to Utils as they most likely will be used many times Co-authored-by: Rime <81419447+Emirlol@users.noreply.github.com> Co-authored-by: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils/ItemUtils.java')
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/ItemUtils.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
index 65807886..894ef8ec 100644
--- a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
+++ b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java
@@ -283,4 +283,24 @@ public final class ItemUtils {
throw new RuntimeException(e);
}
}
+
+ /**
+ * Utility method.
+ */
+ public static @NotNull String getConcatenatedLore(@NotNull ItemStack item) {
+ return concatenateLore(getLore(item));
+ }
+
+ /**
+ * Concatenates the lore of an item into one string.
+ * This is useful in case some pattern we're looking for is split into multiple lines, which would make it harder to regex.
+ */
+ public static @NotNull String concatenateLore(@NotNull List<Text> lore) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < lore.size(); i++) {
+ stringBuilder.append(lore.get(i).getString());
+ if (i != lore.size() - 1) stringBuilder.append(" ");
+ }
+ return stringBuilder.toString();
+ }
}