diff options
author | Fix3dll <serhanduzce@gmail.com> | 2022-03-11 17:16:34 +0300 |
---|---|---|
committer | Fix3dll <serhanduzce@gmail.com> | 2022-03-11 17:16:34 +0300 |
commit | ba65b74f0ba917f7911999a88b5239e9614090a8 (patch) | |
tree | 8ac9a04e7188c574f6f525ef03ec24477aff518a /src/main | |
parent | 8dc87c577903a3cdee415d701d02b7994f942a8e (diff) | |
download | Skyblocker-ba65b74f0ba917f7911999a88b5239e9614090a8.tar.gz Skyblocker-ba65b74f0ba917f7911999a88b5239e9614090a8.tar.bz2 Skyblocker-ba65b74f0ba917f7911999a88b5239e9614090a8.zip |
fix: inoperative contain check
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java index 9a642a4e..0ea21bf5 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java @@ -49,10 +49,10 @@ public class PriceInfoTooltip { int count = stack.getCount(); String timestamp = getTimestamp(stack); - List<String> listString = lines.stream() - .map(Text::getString).toList(); + List<String> listString = lines.stream().map(Text::getString).toList(); - if (SkyblockerConfig.get().general.itemTooltip.enableNPCPrice && !listString.contains("NPC Price")) { + if (SkyblockerConfig.get().general.itemTooltip.enableNPCPrice + && listString.stream().noneMatch(each -> each.contains("NPC Price:"))) { if (npcPricesJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); @@ -65,7 +65,7 @@ public class PriceInfoTooltip { } } - if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN && !listString.contains("Lowest BIN Price")) { + if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN) { if (lowestPricesJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); @@ -78,7 +78,7 @@ public class PriceInfoTooltip { } } - if (SkyblockerConfig.get().general.itemTooltip.enableAvgBIN && !listString.contains("Avg. BIN Price")) { + if (SkyblockerConfig.get().general.itemTooltip.enableAvgBIN) { if (threeDayAvgPricesJson == null || oneDayAvgPricesJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); @@ -137,7 +137,7 @@ public class PriceInfoTooltip { } if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice - && (!listString.contains("Bazaar buy Price") || !listString.contains("Bazaar sell Price"))) { + && listString.stream().noneMatch(each -> each.contains("Buy price:") || each.contains("Sell price:"))) { if (bazaarPricesJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); @@ -154,28 +154,27 @@ public class PriceInfoTooltip { } } - if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate && !listString.contains("Museum")) { + if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate) { if (isMuseumJson == null) { if (!nullMsgSend) { client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false); nullMsgSend = true; } - } else if (isMuseumJson.has(name)) { + } else if (isMuseumJson.has(name) && listString.stream().noneMatch(each -> each.contains("Museum:"))) { String itemCategory = isMuseumJson.get(name).toString().replaceAll("\"", ""); String format = switch (itemCategory) { case "Weapons" -> "%-18s"; case "Armor" -> "%-19s"; default -> "%-20s"; }; - lines.add(new LiteralText(String.format(format, "Museum: (" + itemCategory + ")")) .formatted(Formatting.LIGHT_PURPLE) .append(new LiteralText(timestamp != null ? timestamp : "").formatted(Formatting.RED))); + } else if (timestamp != null && listString.stream().noneMatch(each -> each.contains("Obtained:"))) { + lines.add(new LiteralText(String.format("%-21s", "Obtained: ")) + .formatted(Formatting.LIGHT_PURPLE) + .append(new LiteralText(timestamp).formatted(Formatting.RED))); } - } else if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate && !listString.contains("Obtained") && timestamp != null) { - lines.add(new LiteralText(String.format("%-22s", "Obtained: ")) - .formatted(Formatting.LIGHT_PURPLE) - .append(new LiteralText(timestamp).formatted(Formatting.RED))); } } |