diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-23 03:34:12 +1100 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-11-23 03:34:12 +1100 |
| commit | 089bac89c5435eb7e5cf80e7602da953a65f5b1a (patch) | |
| tree | ea6aea2afc38f6ef02884f0c3babdc5ed86058bb /src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java | |
| parent | 07403ec86c53f67b94d988b4c01a0afc2fdb2810 (diff) | |
| download | notenoughupdates-089bac89c5435eb7e5cf80e7602da953a65f5b1a.tar.gz notenoughupdates-089bac89c5435eb7e5cf80e7602da953a65f5b1a.tar.bz2 notenoughupdates-089bac89c5435eb7e5cf80e7602da953a65f5b1a.zip | |
1.7
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java | 13 |
1 files changed, 13 insertions, 0 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 d6f390c6..e2cc82bd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -40,6 +40,7 @@ public class APIManager { private HashSet<String> playerBidsFinishedNotified = new HashSet<>(); private JsonObject lowestBins = null; + private JsonObject auctionPricesAvgLowestBinJson = null; private LinkedList<Integer> pagesToDownload = null; @@ -662,6 +663,9 @@ public class APIManager { auctionPricesJson = jsonObject; lastAuctionAvgUpdate = System.currentTimeMillis(); }, () -> {}); + manager.hypixelApi.getMyApiGZIPAsync("auction_averages_lbin/3day.json.gz", (jsonObject) -> { + auctionPricesAvgLowestBinJson = jsonObject; + }, () -> {}); } public Set<String> getItemAuctionInfoKeySet() { @@ -682,6 +686,15 @@ public class APIManager { return e.getAsJsonObject(); } + public float getItemAvgBin(String internalname) { + if(auctionPricesAvgLowestBinJson == null) return -1; + JsonElement e = auctionPricesAvgLowestBinJson.get(internalname); + if(e == null) { + return -1; + } + return Math.round(e.getAsFloat()); + } + public JsonObject getBazaarInfo(String internalname) { if(bazaarJson == null) return null; JsonElement e = bazaarJson.get(internalname); |
