diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-06 19:09:11 -0230 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 19:09:11 -0230 |
commit | 93248d28d6b314b42f6b0d82164975343b214ece (patch) | |
tree | e3e06c24454080f059355133d633e5a076d85ad3 /src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java | |
parent | 91464c8f433e8bf323932ac956678971207b607e (diff) | |
parent | 804767ebfc26e2a1252bc327def02389b35dfc6e (diff) | |
download | SkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.tar.gz SkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.tar.bz2 SkyblockHud-Death-Defied-93248d28d6b314b42f6b0d82164975343b214ece.zip |
Merge pull request #2 from ThatGravyBoat/prettier
Add prettier settings and format code
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java index 32f6c80..3b17899 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java @@ -2,12 +2,11 @@ package com.thatgravyboat.skyblockhud.location; import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; import com.thatgravyboat.skyblockhud.api.events.SidebarPostEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Arrays; import java.util.Locale; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class DwarvenMineHandler { @@ -19,7 +18,7 @@ public class DwarvenMineHandler { public int x; public String displayName; - Event(int x, String displayName){ + Event(int x, String displayName) { this.x = x; this.displayName = displayName; } @@ -33,53 +32,52 @@ public class DwarvenMineHandler { private static final DecimalFormat formatter = new DecimalFormat("#,###", DecimalFormatSymbols.getInstance(Locale.CANADA)); - public static String getMithrilFormatted(){ + public static String getMithrilFormatted() { String output = formatter.format(mithril); - if (output.equals(".0")) output = "0.0"; - else if (output.equals(",0")) output = "0,0"; + if (output.equals(".0")) output = "0.0"; else if (output.equals(",0")) output = "0,0"; return output; } - public static void parseMithril(String line){ - try{ + public static void parseMithril(String line) { + try { mithril = Integer.parseInt(line.toLowerCase().replace("mithril powder:", "").trim()); - }catch (Exception ignored){} + } catch (Exception ignored) {} } @SubscribeEvent - public void onSidebarLineUpdate(SidebarLineUpdateEvent event){ - if (event.formattedLine.toLowerCase().contains("mithril")){ - try{ - mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:","").trim()); - }catch (Exception ignored){} + public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { + if (event.formattedLine.toLowerCase().contains("mithril")) { + try { + mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:", "").trim()); + } catch (Exception ignored) {} } - if (event.formattedLine.toLowerCase().contains("event")){ - if (event.formattedLine.toLowerCase().contains("raffle")){ + if (event.formattedLine.toLowerCase().contains("event")) { + if (event.formattedLine.toLowerCase().contains("raffle")) { DwarvenMineHandler.currentEvent = Event.TICKET; - }else if (event.formattedLine.toLowerCase().contains("goblin raid")){ + } else if (event.formattedLine.toLowerCase().contains("goblin raid")) { DwarvenMineHandler.currentEvent = Event.GOBLIN; } } - if (DwarvenMineHandler.currentEvent != Event.NONE){ - if (DwarvenMineHandler.currentEvent == Event.TICKET && event.formattedLine.toLowerCase().contains("tickets:")){ - if (event.formattedLine.toLowerCase().contains("pool:")){ - try{ - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:","").trim().split("/")[0].trim()); - }catch (Exception ignored){} - }else if (event.formattedLine.toLowerCase().contains("tickets:")){ - try{ + if (DwarvenMineHandler.currentEvent != Event.NONE) { + if (DwarvenMineHandler.currentEvent == Event.TICKET && event.formattedLine.toLowerCase().contains("tickets:")) { + if (event.formattedLine.toLowerCase().contains("pool:")) { + try { + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim()); + } catch (Exception ignored) {} + } else if (event.formattedLine.toLowerCase().contains("tickets:")) { + try { eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim()); - }catch (Exception ignored){} + } catch (Exception ignored) {} } - }else if (DwarvenMineHandler.currentEvent == Event.GOBLIN){ - if (event.formattedLine.toLowerCase().contains("remaining:")){ - try{ - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins","").replace("remaining:","").trim()); - }catch (Exception ignored){} - }else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")){ - try{ - eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:","").trim()); - }catch (Exception ignored){} + } else if (DwarvenMineHandler.currentEvent == Event.GOBLIN) { + if (event.formattedLine.toLowerCase().contains("remaining:")) { + try { + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); + } catch (Exception ignored) {} + } else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")) { + try { + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim()); + } catch (Exception ignored) {} } } } @@ -88,7 +86,7 @@ public class DwarvenMineHandler { @SubscribeEvent public void onSidebarPost(SidebarPostEvent event) { String arrayString = Arrays.toString(event.arrayScores); - if (!arrayString.toLowerCase().contains("event:")){ + if (!arrayString.toLowerCase().contains("event:")) { DwarvenMineHandler.currentEvent = Event.NONE; DwarvenMineHandler.eventProgress = 0; DwarvenMineHandler.eventMax = 0; |