From cceaa38e7c1783d0446a50dbb09e42b8287e38d1 Mon Sep 17 00:00:00 2001 From: UpFault <76474308+UpFault@users.noreply.github.com> Date: Thu, 18 Jul 2024 03:07:33 -0500 Subject: 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> --- .../java/de/hysky/skyblocker/utils/ItemUtils.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/main/java/de/hysky/skyblocker/utils/ItemUtils.java') 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 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(); + } } -- cgit