aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
diff options
context:
space:
mode:
authorFix3dll <serhanduzce@gmail.com>2022-04-03 15:27:58 +0300
committerFix3dll <serhanduzce@gmail.com>2022-04-03 15:27:58 +0300
commite68587ae9609128f2658a6bccd1a331792b326a9 (patch)
tree7b22eef952a607498a90825d8aa4093741aa9fb4 /src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
parent30fed24fd00dd8dfa0ff0de4c319cc9ad2273717 (diff)
downloadSkyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.tar.gz
Skyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.tar.bz2
Skyblocker-e68587ae9609128f2658a6bccd1a331792b326a9.zip
fix: Fire trial interaction with Fancybar,
bazaar and lbin appearing at same time a cleaner look for bazaar without extra tooltip
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java44
1 files changed, 24 insertions, 20 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 290bd0ae..ddb290a7 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
@@ -49,6 +49,7 @@ public class PriceInfoTooltip {
int count = stack.getCount();
String timestamp = getTimestamp(stack);
+ boolean bazaarOpened = lines.stream().anyMatch(each -> each.getString().contains("Buy price:") || each.getString().contains("Sell price:"));
if (SkyblockerConfig.get().general.itemTooltip.enableNPCPrice) {
if (npcPricesJson == null) {
@@ -63,7 +64,28 @@ public class PriceInfoTooltip {
}
}
- if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN) {
+ boolean bazaarExist = false;
+ if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice
+ && !bazaarOpened) {
+ if (bazaarPricesJson == null) {
+ if (!nullMsgSend) {
+ client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false);
+ nullMsgSend = true;
+ }
+ } else if (bazaarPricesJson.has(name)) {
+ JsonObject getItem = bazaarPricesJson.getAsJsonObject(name);
+ lines.add(new LiteralText(String.format("%-18s", "Bazaar buy Price:"))
+ .formatted(Formatting.GOLD)
+ .append(getCoinsMessage(getItem.get("buyPrice").getAsDouble(), count)));
+ lines.add(new LiteralText(String.format("%-19s", "Bazaar sell Price:"))
+ .formatted(Formatting.GOLD)
+ .append(getCoinsMessage(getItem.get("sellPrice").getAsDouble(), count)));
+ bazaarExist = true;
+ }
+ }
+
+ // bazaarOpened & bazaarExist check for lbin, because Skytils keeps some bazaar item data in lbin api
+ if (SkyblockerConfig.get().general.itemTooltip.enableLowestBIN && !bazaarOpened && !bazaarExist) {
if (lowestPricesJson == null) {
if (!nullMsgSend) {
client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false);
@@ -134,25 +156,7 @@ public class PriceInfoTooltip {
}
}
- if (SkyblockerConfig.get().general.itemTooltip.enableBazaarPrice
- && lines.stream().noneMatch(each -> each.getString().contains("Buy price:") || each.getString().contains("Sell price:"))) {
- if (bazaarPricesJson == null) {
- if (!nullMsgSend) {
- client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false);
- nullMsgSend = true;
- }
- } else if (bazaarPricesJson.has(name)) {
- JsonObject getItem = bazaarPricesJson.getAsJsonObject(name);
- lines.add(new LiteralText(String.format("%-18s", "Bazaar buy Price:"))
- .formatted(Formatting.GOLD)
- .append(getCoinsMessage(getItem.get("buyPrice").getAsDouble(), count)));
- lines.add(new LiteralText(String.format("%-19s", "Bazaar sell Price:"))
- .formatted(Formatting.GOLD)
- .append(getCoinsMessage(getItem.get("sellPrice").getAsDouble(), count)));
- }
- }
-
- if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate) {
+ if (SkyblockerConfig.get().general.itemTooltip.enableMuseumDate && !bazaarOpened) {
if (isMuseumJson == null) {
if (!nullMsgSend) {
client.player.sendMessage(new TranslatableText("skyblocker.itemTooltip.nullMessage"), false);