diff options
author | UpFault <76474308+UpFault@users.noreply.github.com> | 2024-07-18 03:07:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 16:07:33 +0800 |
commit | cceaa38e7c1783d0446a50dbb09e42b8287e38d1 (patch) | |
tree | 5a4f94c94a8822bf262e5b465c384dd11686aac2 /src/main/java/de/hysky/skyblocker/utils | |
parent | 50b7a167253683d1526ac16a46e36adf1f5300d5 (diff) | |
download | Skyblocker-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')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/ItemUtils.java | 20 | ||||
-rw-r--r-- | src/main/java/de/hysky/skyblocker/utils/Utils.java | 2 |
2 files changed, 21 insertions, 1 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(); + } } diff --git a/src/main/java/de/hysky/skyblocker/utils/Utils.java b/src/main/java/de/hysky/skyblocker/utils/Utils.java index bbeb11b5..042095d1 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Utils.java +++ b/src/main/java/de/hysky/skyblocker/utils/Utils.java @@ -158,7 +158,7 @@ public class Utils { /** * Can be used to restrict features to being active only on the Alpha network. - * + * * @return the current environment parsed from the Mod API. */ @NotNull |