aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java2
2 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index c47e0844..f46c8334 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -41,6 +41,9 @@ public class APIManager {
private final HashSet<String> playerBids = new HashSet<>();
private final HashSet<String> playerBidsNotified = new HashSet<>();
private final HashSet<String> playerBidsFinishedNotified = new HashSet<>();
+ private final int LOWEST_BIN_UPDATE_INTERVAL = 2 * 60 * 1000; // 2 minutes
+ private final int AUCTION_AVG_UPDATE_INTERVAL = 5 * 60 * 1000; // 5 minutes
+ private final int BAZAAR_UPDATE_INTERVAL = 5 * 60 * 1000; // 5 minutes
private JsonObject lowestBins = null;
private JsonObject auctionPricesAvgLowestBinJson = null;
@@ -203,15 +206,16 @@ public class APIManager {
}
}
}
- if (currentTime - lastAuctionAvgUpdate > 5 * 60 * 1000) { //5 minutes
- lastAuctionAvgUpdate = currentTime - 4 * 60 * 1000; //Try again in 1 minute if updateAvgPrices doesn't succeed
+ if (currentTime - lastAuctionAvgUpdate > AUCTION_AVG_UPDATE_INTERVAL) {
+ lastAuctionAvgUpdate = currentTime - AUCTION_AVG_UPDATE_INTERVAL + 60 * 1000; // Try again in 1 minute on failure
updateAvgPrices();
}
- if (currentTime - lastBazaarUpdate > 5 * 60 * 1000) { //5 minutes
- lastBazaarUpdate = currentTime;
+ if (currentTime - lastBazaarUpdate > BAZAAR_UPDATE_INTERVAL) {
+ lastBazaarUpdate = currentTime - BAZAAR_UPDATE_INTERVAL + 60 * 1000; // Try again in 1 minute on failure
updateBazaar();
}
- if (currentTime - lastLowestBinUpdate > 2 * 60 * 1000) {
+ if (currentTime - lastLowestBinUpdate > LOWEST_BIN_UPDATE_INTERVAL) {
+ lastLowestBinUpdate = currentTime - LOWEST_BIN_UPDATE_INTERVAL + 30 * 1000; // Try again in 30 seconds on failure
updateLowestBin();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
index 63a08d41..66014b1f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java
@@ -418,7 +418,7 @@ public class GuiPriceGraph extends GuiScreen {
item.getValue().getAsJsonObject().get("curr_sell").getAsFloat()
));
else if (!bazaar)
- prices.get(item.getKey()).ah.put(epochSecond, item.getValue().getAsInt());
+ prices.get(item.getKey()).ah.put(epochSecond, item.getValue().getAsBigDecimal().intValue());
} else {
TreeMap<Long, Object> mapData = new TreeMap<>();
if (bazaar && item.getValue().getAsJsonObject().has("curr_buy") && item.getValue().getAsJsonObject().has(