aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/tracker
diff options
context:
space:
mode:
authorThatGravyBoat <ThatGravyBoat@users.noreply.github.com>2021-09-27 16:50:17 +0000
committerGitHub Action <actions@github.com>2021-09-27 16:50:17 +0000
commit50885a0b0bd9ad39885b68efb20a1276f16886a3 (patch)
tree070e35e2bcc8ba551ec7f2517992182911c83859 /src/main/java/com/thatgravyboat/skyblockhud/tracker
parent06c495fd067ed5c16b34322d41e9674319e09506 (diff)
downloadSkyblockHud-Death-Defied-50885a0b0bd9ad39885b68efb20a1276f16886a3.tar.gz
SkyblockHud-Death-Defied-50885a0b0bd9ad39885b68efb20a1276f16886a3.tar.bz2
SkyblockHud-Death-Defied-50885a0b0bd9ad39885b68efb20a1276f16886a3.zip
Prettified Code!
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/tracker')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java70
1 files changed, 31 insertions, 39 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
index 1e7d64e..7401dd8 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
@@ -22,14 +22,12 @@ public class TrackerFileLoader {
tracker
.get("location")
.getAsJsonArray()
- .forEach(
- l -> {
- Locations location = Locations.get(l.getAsString().toUpperCase(Locale.ENGLISH));
- if (location != Locations.DEFAULT) {
- locations.add(location);
- }
+ .forEach(l -> {
+ Locations location = Locations.get(l.getAsString().toUpperCase(Locale.ENGLISH));
+ if (location != Locations.DEFAULT) {
+ locations.add(location);
}
- );
+ });
if (tracker.has("drops")) {
for (JsonElement drop : tracker.get("drops").getAsJsonArray()) {
TrackerHandler.trackerObjects.add(new TrackerObject(drop.getAsJsonObject(), locations));
@@ -70,19 +68,17 @@ public class TrackerFileLoader {
private static JsonElement getTrackerFile() {
JsonArray stats = new JsonArray();
- TrackerHandler.trackerObjects.forEach(
- trackerObject -> {
- if (trackerObject.getCount() > 0) {
- JsonObject jsonObject = new JsonObject();
- JsonArray locations = new JsonArray();
- trackerObject.getLocations().forEach(l -> locations.add(new JsonPrimitive(l.toString().toUpperCase(Locale.ENGLISH))));
- jsonObject.add("id", new JsonPrimitive(trackerObject.getInternalId()));
- jsonObject.add("locations", locations);
- jsonObject.add("count", new JsonPrimitive(trackerObject.getCount()));
- stats.add(jsonObject);
- }
+ TrackerHandler.trackerObjects.forEach(trackerObject -> {
+ if (trackerObject.getCount() > 0) {
+ JsonObject jsonObject = new JsonObject();
+ JsonArray locations = new JsonArray();
+ trackerObject.getLocations().forEach(l -> locations.add(new JsonPrimitive(l.toString().toUpperCase(Locale.ENGLISH))));
+ jsonObject.add("id", new JsonPrimitive(trackerObject.getInternalId()));
+ jsonObject.add("locations", locations);
+ jsonObject.add("count", new JsonPrimitive(trackerObject.getCount()));
+ stats.add(jsonObject);
}
- );
+ });
return stats;
}
@@ -99,29 +95,25 @@ public class TrackerFileLoader {
if (json.has("trackerStats")) {
json
.getAsJsonArray("trackerStats")
- .forEach(
- element -> {
- if (element.isJsonObject()) {
- JsonObject object = element.getAsJsonObject();
- JsonArray locations = object.get("locations").getAsJsonArray();
- Locations firstLocation = null;
- for (JsonElement location : locations) {
- firstLocation = Locations.get(location.getAsString());
- if (!firstLocation.equals(Locations.DEFAULT)) break;
- }
-
- if (firstLocation != null && !firstLocation.equals(Locations.DEFAULT)) {
- TrackerHandler.trackers.get(firstLocation).get(object.get("id").getAsString()).setCount(object.get("count").getAsInt());
- }
+ .forEach(element -> {
+ if (element.isJsonObject()) {
+ JsonObject object = element.getAsJsonObject();
+ JsonArray locations = object.get("locations").getAsJsonArray();
+ Locations firstLocation = null;
+ for (JsonElement location : locations) {
+ firstLocation = Locations.get(location.getAsString());
+ if (!firstLocation.equals(Locations.DEFAULT)) break;
+ }
+
+ if (firstLocation != null && !firstLocation.equals(Locations.DEFAULT)) {
+ TrackerHandler.trackers.get(firstLocation).get(object.get("id").getAsString()).setCount(object.get("count").getAsInt());
}
}
- );
+ });
- TrackerHandler.trackers.forEach(
- (location, map) -> {
- TrackerHandler.trackers.put(location, TrackerHandler.sortTrackers(map, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount())));
- }
- );
+ TrackerHandler.trackers.forEach((location, map) -> {
+ TrackerHandler.trackers.put(location, TrackerHandler.sortTrackers(map, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount())));
+ });
}
}
} catch (Exception ignored) {}