diff options
author | RayDeeUx <raydeeux@gmail.com> | 2022-08-19 11:01:29 -0400 |
---|---|---|
committer | RayDeeUx <raydeeux@gmail.com> | 2022-08-19 11:01:29 -0400 |
commit | 62d9012e1b9b5a3337f5a9f0e01fd684c860a4ce (patch) | |
tree | 4270337e299f58487a1f0851303e5ed44bb50584 /src/main/java/com/thatgravyboat | |
parent | d6751da4434b97237d278e1666c031084cd57934 (diff) | |
download | SkyblockHud-Death-Defied-62d9012e1b9b5a3337f5a9f0e01fd684c860a4ce.tar.gz SkyblockHud-Death-Defied-62d9012e1b9b5a3337f5a9f0e01fd684c860a4ce.tar.bz2 SkyblockHud-Death-Defied-62d9012e1b9b5a3337f5a9f0e01fd684c860a4ce.zip |
#BanishTheCommas
Diffstat (limited to 'src/main/java/com/thatgravyboat')
10 files changed, 35 insertions, 34 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 83b2c09..7d37ada 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -54,7 +54,7 @@ public class ComponentHandler { } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { - FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); + FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java index 5a5e4ec..3f9c2da 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java @@ -53,7 +53,7 @@ public class DungeonHandler { int healthNum = 0; if (!health.equalsIgnoreCase("dead")) { try { - healthNum = Integer.parseInt(health); + healthNum = Integer.parseInt(health.replaceAll(",", "")); } catch (NumberFormatException ignored) {} } DungeonPlayer player = new DungeonPlayer(playerClass, displayName, healthNum, health.equalsIgnoreCase("dead")); @@ -68,8 +68,8 @@ public class DungeonHandler { String[] times = timeLine.split("m "); int time = 0; try { - time += Integer.parseInt(times[0].replace(" ", "").replace("m", "")) * 60; - time += Integer.parseInt(times[1].replace(" ", "").replace("s", "")); + time += Integer.parseInt(times[0].replace(" ", "").replace("m", "").replaceAll(",", "")) * 60; + time += Integer.parseInt(times[1].replace(" ", "").replace("s", "").replaceAll(",", "")); } catch (NumberFormatException ignored) {} dungeonTime = time; } @@ -77,7 +77,7 @@ public class DungeonHandler { public static void checkForDungeonCleared(String scoreline) { if (scoreline.toLowerCase().trim().contains("dungeon cleared:")) { - String dungeonClearedText = scoreline.toLowerCase().trim().replace("dungeon cleared:", "").replace(" ", "").replace("%", ""); + String dungeonClearedText = scoreline.toLowerCase().trim().replace("dungeon cleared:", "").replace(" ", "").replace("%", "").replaceAll(",", ""); try { dungeonCleared = Integer.parseInt(dungeonClearedText); } catch (NumberFormatException ignored) {} @@ -86,7 +86,7 @@ public class DungeonHandler { public static void checkForDungeonKeys(String scoreline, String rawString) { if (scoreline.toLowerCase().trim().contains("keys:")) { - String dungeonClearedText = scoreline.toLowerCase().trim().replace("keys:", "").replace(" ", "").replace("x", ""); + String dungeonClearedText = scoreline.toLowerCase().trim().replace("keys:", "").replace(" ", "").replace("x", "").replaceAll(",", ""); bloodKey = rawString.contains("\u2713"); try { witherKeys = Integer.parseInt(dungeonClearedText); @@ -101,7 +101,7 @@ public class DungeonHandler { if (part.toLowerCase().contains("secrets") && !statusBar.toLowerCase().contains("no secrets")) { hasSecrets = true; try { - String secret = Utils.removeColor(part.replace("Secrets", "")).replace(" ", ""); + String secret = Utils.removeColor(part.replace("Secrets", "")).replace(" ", "").replaceAll(",", ""); maxSecrets = Integer.parseInt(secret.split("/")[1]); secrets = Integer.parseInt(secret.split("/")[0]); } catch (NumberFormatException ignored) {} @@ -115,7 +115,7 @@ public class DungeonHandler { public static void parseTotalSecrets(String playerName) { if (playerName.toLowerCase().contains("secrets found:")) { - String totalSecret = Utils.removeColor(playerName.toLowerCase().replace("secrets found:", "")).replace(" ", ""); + String totalSecret = Utils.removeColor(playerName.toLowerCase().replace("secrets found:", "")).replace(" ", "").replaceAll(",", ""); try { totalSecrets = Integer.parseInt(totalSecret); } catch (NumberFormatException ignored) {} @@ -124,7 +124,7 @@ public class DungeonHandler { public static void parseDeaths(String playerName) { if (playerName.toLowerCase().contains("deaths:")) { - String death = Utils.removeColor(playerName.toLowerCase().replace("deaths:", "")).replace("(", "").replace(")", "").replace(" ", ""); + String death = Utils.removeColor(playerName.toLowerCase().replace("deaths:", "")).replace("(", "").replace(")", "").replace(" ", "").replaceAll(",", ""); try { deaths = Integer.parseInt(death); } catch (NumberFormatException ignored) {} @@ -133,7 +133,7 @@ public class DungeonHandler { public static void parseCrypts(String playerName) { if (playerName.toLowerCase().contains("crypts:")) { - String crypt = Utils.removeColor(playerName.toLowerCase().replace("crypts:", "")).replace(" ", ""); + String crypt = Utils.removeColor(playerName.toLowerCase().replace("crypts:", "")).replace(" ", "").replaceAll(",", ""); try { crypts = Integer.parseInt(crypt); } catch (NumberFormatException ignored) {} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java index 2feef38..1dda839 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java @@ -23,7 +23,7 @@ public class HeldItemHandler extends Gui { Matcher matcher = MANA_COST_REGEX.matcher(lore); if (matcher.find()) { try { - return Integer.parseInt(matcher.group(1)); + return Integer.parseInt(matcher.group(1).replaceAll(",", "")); } catch (Exception ignored) {} } return 0; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java index 49f3ca5..5ed667d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java @@ -95,7 +95,7 @@ public class SlayerHandler { if (!isDoingSlayer && event.formattedLine.equals("Slayer Quest")) isDoingSlayer = true; if (isDoingSlayer) { - String line = event.formattedLine.toLowerCase(); + String line = event.formattedLine.toLowerCase().replaceAll(",", ""); Matcher killMatcher = KILLS_REGEX.matcher(line); if (killMatcher.find()) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java index 005d9ff..884ff32 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java @@ -21,7 +21,7 @@ public class FarmHouseHandler { for (Medal value : Medal.values()) { if (event.formattedLine.contains(value.name())) { try { - medals[value.ordinal()] = Integer.parseInt(event.formattedLine.replace("medals:", "").replace(value.name(), "").trim()); + medals[value.ordinal()] = Integer.parseInt(event.formattedLine.replace("medals:", "").replace(value.name(), "").trim().replaceAll(",", "")); } catch (Exception ignored) {} break; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java index cc6668a..223eaf0 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java @@ -31,22 +31,22 @@ public class IslandHandler { if (times.length == 2) { int s = 0; try { - s += Integer.parseInt(times[0]) * 60; + s += Integer.parseInt(times[0].replaceAll(",", "")) * 60; } catch (NumberFormatException ignored) {} try { - s += Integer.parseInt(times[1]); + s += Integer.parseInt(times[1].replaceAll(",", "")); } catch (NumberFormatException ignored) {} flightTime = s - 1; } else if (times.length == 3) { int s = 0; try { - s += Integer.parseInt(times[0]) * 3600; + s += Integer.parseInt(times[0].replaceAll(",", "")) * 3600; } catch (NumberFormatException ignored) {} try { - s += Integer.parseInt(times[1]) * 60; + s += Integer.parseInt(times[1].replaceAll(",", "")) * 60; } catch (NumberFormatException ignored) {} try { - s += Integer.parseInt(times[2]); + s += Integer.parseInt(times[2].replaceAll(",", "")); } catch (NumberFormatException ignored) {} flightTime = s - 1; } @@ -59,7 +59,7 @@ public class IslandHandler { if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND) { if (formatedScoreboardLine.toLowerCase().contains("redstone:")) return true; try { - redstone = formatedScoreboardLine.toLowerCase().contains("redstone:") ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:")) : 0; + redstone = formatedScoreboardLine.toLowerCase().contains("redstone:") ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:").replaceAll(",", "")) : 0; } catch (Exception ignored) {} } return false; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java index d49b681..865b2c1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/MinesHandler.java @@ -73,13 +73,13 @@ public class MinesHandler { public static void parseMithril(String line) { try { - mithril = Integer.parseInt(line.toLowerCase().replace("mithril powder:", "").trim()); + mithril = Integer.parseInt(line.toLowerCase().replace("mithril powder:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } public static void parseGemstone(String line) { try { - gemstone = Integer.parseInt(line.toLowerCase().replace("gemstone powder:", "").trim()); + gemstone = Integer.parseInt(line.toLowerCase().replace("gemstone powder:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } @@ -87,17 +87,17 @@ public class MinesHandler { public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { if (event.formattedLine.toLowerCase().contains("heat")) { try { - MiningHud.setHeat(Integer.parseInt(event.formattedLine.toLowerCase().replace("heat:", "").trim())); + MiningHud.setHeat(Integer.parseInt(event.formattedLine.toLowerCase().replace("heat:", "").trim().replaceAll(",", ""))); } catch (Exception ignored) {} } if (event.formattedLine.toLowerCase().contains("mithril")) { try { - mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:", "").trim()); + mithril = Integer.parseInt(event.formattedLine.toLowerCase().replace("mithril:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } if (event.formattedLine.toLowerCase().contains("gemstone")) { try { - gemstone = Integer.parseInt(event.formattedLine.toLowerCase().replace("gemstone:", "").trim()); + gemstone = Integer.parseInt(event.formattedLine.toLowerCase().replace("gemstone:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } if (event.formattedLine.toLowerCase().contains("event")) { @@ -115,7 +115,7 @@ public class MinesHandler { if (event.formattedLine.toLowerCase(Locale.ENGLISH).contains("nearby players")) { MinesHandler.currentEvent = Event.TOGETHER; try { - MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players:", "").trim()); + MinesHandler.eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("nearby players:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } @@ -123,31 +123,31 @@ public class MinesHandler { if (MinesHandler.currentEvent == Event.TICKET) { if (event.formattedLine.toLowerCase().contains("pool:")) { try { - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim()); + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().replaceAll(",", "").split("/")[0].trim().replaceAll(",", "")); } catch (Exception ignored) {} } else if (event.formattedLine.toLowerCase().contains("tickets:")) { try { - eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim()); + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim().replaceAll(",", "")); } catch (Exception ignored) {} } } else if (MinesHandler.currentEvent == Event.GOBLIN) { if (event.formattedLine.toLowerCase().contains("remaining:")) { try { - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim().replaceAll(",", "")); } 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()); + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } } else if (MinesHandler.currentEvent == Event.GOURMAND) { if (event.formattedLine.toLowerCase().contains("remaining:")) { try { - eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("tasty mithril", "").replace("remaining:", "").trim()); + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("tasty mithril", "").replace("remaining:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } else if (event.formattedLine.toLowerCase().contains("your tasty mithril:") && !event.formattedLine.toLowerCase().contains("(")) { try { - eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your tasty mithril:", "").trim()); + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your tasty mithril:", "").trim().replaceAll(",", "")); } catch (Exception ignored) {} } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java index 1f372ad..47c6f77 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinItemStack.java @@ -24,7 +24,7 @@ public class MixinItemStack implements IAbility { if (abilityMatcher != null) { ability = abilityMatcher.group(1); try { - abilityTime = Integer.parseInt(abilityMatcher.group(2).trim()); + abilityTime = Integer.parseInt(abilityMatcher.group(2).trim().replaceAll(",", "")); } catch (Exception ignored) {} } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index 30f14fa..380f4a5 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -101,6 +101,7 @@ public class ActionBarParsing { if (!lastActionBar.equals(input)) { lastActionBar = input; String bar = Utils.removeColor(input); + String fuckHypixelForAddingCommas = bar; bar = bar.replaceAll(",", ""); Matcher HealthMatcher = HealthRegex.matcher(bar); @@ -108,7 +109,7 @@ public class ActionBarParsing { Matcher ManaMatcher = ManaRegex.matcher(bar); Matcher ManaUseMatcher = ManaDecreaseRegex.matcher(bar); Matcher ManaOverflowMatcher = ManaOverflowRegex.matcher(bar); - Matcher XpGainMatcher = XpGainRegex.matcher(bar); + Matcher XpGainMatcher = XpGainRegex.matcher(fuckHypixelForAddingCommas); // Matcher DominusMatcher = DominusRegex.matcher(bar); boolean healthFound = HealthMatcher.find(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java index 02cc490..4b6755f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java @@ -68,6 +68,6 @@ public class SeasonDateHandler { } public static int removeSeason(String seasonDate) { - return Integer.parseInt(Pattern.compile("[^0-9]").matcher(seasonDate.toLowerCase()).replaceAll("").trim()); + return Integer.parseInt(Pattern.compile("[^0-9]").matcher(seasonDate.toLowerCase()).replaceAll("").trim().replaceAll(",", "")); } } |