diff options
author | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:24:20 -0400 |
---|---|---|
committer | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:24:20 -0400 |
commit | 98ee5a2ae8090c061b1e61e7955d793416991822 (patch) | |
tree | e34bb84ed247f08f2931f10d1dfbf6c8b883004c /src/main/java/com/thatgravyboat/skyblockhud/tracker | |
parent | c04ca523f9fb9f7adefa74587db61f76deeae9f0 (diff) | |
download | SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.tar.gz SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.tar.bz2 SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.zip |
140?
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/tracker')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java | 29 | ||||
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java | 11 |
2 files changed, 9 insertions, 31 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java index ba22101..858770a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java @@ -28,10 +28,7 @@ public class TrackerFileLoader { if (jsonObject.has("skullData") && displayItemId.equals("minecraft:skull") && meta == 3) { stack.setTagInfo("SkullOwner", getSkullTag(jsonObject.getAsJsonObject("skullData"))); } - if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) stack.setTagInfo( - "ench", - new NBTTagList() - ); + if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) stack.setTagInfo("ench", new NBTTagList()); return stack; } @@ -97,10 +94,7 @@ public class TrackerFileLoader { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("location", locations); - if (event == null) jsonObject.add("event", new JsonNull()); else jsonObject.addProperty( - "event", - event - ); + if (event == null) jsonObject.add("event", new JsonNull()); else jsonObject.addProperty("event", event); JsonObject dropsData = new JsonObject(); drops.forEach((s, stack) -> dropsData.addProperty(s, stack.stackSize)); @@ -134,9 +128,7 @@ public class TrackerFileLoader { } try ( - BufferedReader reader = new BufferedReader( - new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) ) { JsonObject json = gson.fromJson(reader, JsonObject.class); if (json.has("trackerStats")) { @@ -147,19 +139,14 @@ public class TrackerFileLoader { if (element.isJsonObject()) { JsonObject object = element.getAsJsonObject(); String location = object.get("location").getAsString(); - Map<String, Map<String, ItemStack>> trackers = TrackerHandler.trackers.get(location) - .dropTrackers; + Map<String, Map<String, ItemStack>> trackers = TrackerHandler.trackers.get(location).dropTrackers; JsonElement event = object.get("event"); - String eventString = event == null || event.isJsonNull() - ? null - : event.getAsString(); + String eventString = event == null || event.isJsonNull() ? null : event.getAsString(); Map<String, ItemStack> drops = trackers.get(eventString); if (drops != null) { - for (Map.Entry<String, JsonElement> drop : object - .getAsJsonObject("drops") - .entrySet()) { + for (Map.Entry<String, JsonElement> drop : object.getAsJsonObject("drops").entrySet()) { if (drops.containsKey(drop.getKey())) { drops.get(drop.getKey()).stackSize = drop.getValue().getAsInt(); } @@ -183,9 +170,7 @@ public class TrackerFileLoader { configFile.createNewFile(); try ( - BufferedWriter writer = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) ) { JsonObject json = new JsonObject(); json.add("trackerStats", getTrackerFile()); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index 2d5607f..f0a5b90 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -27,12 +27,7 @@ public class TrackerHandler { } public String getDropId(String event) { - if ( - event == null || - event.isEmpty() || - !eventGoing() || - !dropTrackers.containsKey(event.toLowerCase().trim()) - ) return null; + if (event == null || event.isEmpty() || !eventGoing() || !dropTrackers.containsKey(event.toLowerCase().trim())) return null; return event.toLowerCase().trim(); } @@ -99,9 +94,7 @@ public class TrackerHandler { Minecraft mc = Minecraft.getMinecraft(); TrackerData tracked = trackers.get(trackerId); - Map<String, ItemStack> tracker = tracked.dropTrackers.get( - tracked.getDropId(SeasonDateHandler.getCurrentEvent()) - ); + Map<String, ItemStack> tracker = tracked.dropTrackers.get(tracked.getDropId(SeasonDateHandler.getCurrentEvent())); if (tracker != null) { Position pos = SkyblockHud.config.trackers.trackerPosition; int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 120 : tracker.size() * 20)); |