diff options
author | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:20:49 -0400 |
---|---|---|
committer | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:20:49 -0400 |
commit | c04ca523f9fb9f7adefa74587db61f76deeae9f0 (patch) | |
tree | f148e7bcd9105813d3fe781badcb2cf3892712fd /src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java | |
parent | a8e475fa0a7977f64f072548459d592274169d66 (diff) | |
download | SkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.gz SkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.tar.bz2 SkyblockHud-Death-Defied-c04ca523f9fb9f7adefa74587db61f76deeae9f0.zip |
Increase line width
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java | 88 |
1 files changed, 20 insertions, 68 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index a37726f..44a250f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -18,43 +18,23 @@ public class ActionBarParsing { private static String lastLowActionBar = ""; private static IChatComponent lastLowEditedActionBar = null; - private static final Pattern HealthRegex = Pattern.compile( - "([0-9]+)/([0-9]+)\u2764" - ); - private static final Pattern HealingRegex = Pattern.compile( - "\\+([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]" - ); - private static final Pattern DefenseRegex = Pattern.compile( - "([0-9]+)\u2748 Defense" - ); - private static final Pattern ManaRegex = Pattern.compile( - "([0-9]+)/([0-9]+)\u270E Mana" - ); - private static final Pattern ManaOverflowRegex = Pattern.compile( - "([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC" - ); - private static final Pattern ManaDecreaseRegex = Pattern.compile( - "-([0-9]+) Mana \\(" - ); + private static final Pattern HealthRegex = Pattern.compile("([0-9]+)/([0-9]+)\u2764"); + private static final Pattern HealingRegex = Pattern.compile("\\+([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); + private static final Pattern DefenseRegex = Pattern.compile("([0-9]+)\u2748 Defense"); + private static final Pattern ManaRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E Mana"); + private static final Pattern ManaOverflowRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC"); + private static final Pattern ManaDecreaseRegex = Pattern.compile("-([0-9]+) Mana \\("); private static final Pattern XpGainRegex = Pattern.compile( "\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting) \\((\\d*\\.?\\d*)%\\)" ); - private static final Pattern HealthReplaceRegex = Pattern.compile( - "\u00A7c([0-9]+)/([0-9]+)\u2764" - ); + private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764"); private static final Pattern HealingReplaceRegex = Pattern.compile( "\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]" ); - private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile( - "\u00A76([0-9]+)/([0-9]+)\u2764" - ); - private static final Pattern DefenseReplaceRegex = Pattern.compile( - "\u00A7a([0-9]+)\u00A7a\u2748 Defense" - ); - private static final Pattern ManaReplaceRegex = Pattern.compile( - "\u00A7b([0-9]+)/([0-9]+)\u270E Mana" - ); + private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76([0-9]+)/([0-9]+)\u2764"); + private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a([0-9]+)\u00A7a\u2748 Defense"); + private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E Mana"); private static final Pattern ManaOverflowReplaceRegex = Pattern.compile( "\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC" ); @@ -66,10 +46,7 @@ public class ActionBarParsing { public void tick(TickEvent.ClientTickEvent event) { if (predict) { ticksSinceLastPrediction++; - if ( - ticksSinceLastPrediction == 20 && - SkyblockHud.config.rpg.showRpgHud - ) { + if (ticksSinceLastPrediction == 20 && SkyblockHud.config.rpg.showRpgHud) { ticksSinceLastPrediction = 0; RPGHud.manaPredictionUpdate(true, 0); } @@ -78,37 +55,22 @@ public class ActionBarParsing { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBarHigh(ClientChatReceivedEvent event) { - if ( - event.type == 2 && - SkyblockHud.hasSkyblockScoreboard() && - SkyblockHud.config.rpg.showRpgHud - ) { + if (event.type == 2 && SkyblockHud.hasSkyblockScoreboard() && SkyblockHud.config.rpg.showRpgHud) { parseActionBar(event.message.getUnformattedText()); } } @SubscribeEvent(priority = EventPriority.LOW) public void onStatusBarLow(ClientChatReceivedEvent event) { - if ( - event.type == 2 && - SkyblockHud.hasSkyblockScoreboard() && - SkyblockHud.config.rpg.showRpgHud - ) { + if (event.type == 2 && SkyblockHud.hasSkyblockScoreboard() && SkyblockHud.config.rpg.showRpgHud) { String message = event.message.getUnformattedText(); - if ( - lastLowEditedActionBar == null || - !lastLowActionBar.equals(message) - ) { + if (lastLowEditedActionBar == null || !lastLowActionBar.equals(message)) { lastLowActionBar = message; message = HealthReplaceRegex.matcher(message).replaceAll(""); - message = - HealthAbsorptionReplaceRegex - .matcher(message) - .replaceAll(""); + message = HealthAbsorptionReplaceRegex.matcher(message).replaceAll(""); message = DefenseReplaceRegex.matcher(message).replaceAll(""); message = ManaReplaceRegex.matcher(message).replaceAll(""); - message = - ManaOverflowReplaceRegex.matcher(message).replaceAll(""); + message = ManaOverflowReplaceRegex.matcher(message).replaceAll(""); lastLowEditedActionBar = new ChatComponentText(message.trim()); } @@ -145,19 +107,14 @@ public class ActionBarParsing { } if (defenseFound) { try { - RPGHud.updateDefense( - Integer.parseInt(DefenseMatcher.group(1)) - ); + RPGHud.updateDefense(Integer.parseInt(DefenseMatcher.group(1))); } catch (Exception ignored) {} } else if (!xpFound && !manaUseFound) { RPGHud.updateDefense(0); } if (manaFound) { try { - RPGHud.updateMana( - Integer.parseInt(ManaMatcher.group(1)), - Integer.parseInt(ManaMatcher.group(2)) - ); + RPGHud.updateMana(Integer.parseInt(ManaMatcher.group(1)), Integer.parseInt(ManaMatcher.group(2))); } catch (Exception ignored) {} } if (!manaFound && manaOverflowFound) { @@ -166,18 +123,13 @@ public class ActionBarParsing { Integer.parseInt(ManaOverflowMatcher.group(1)), Integer.parseInt(ManaOverflowMatcher.group(2)) ); - RPGHud.updateOverflow( - Integer.parseInt(ManaOverflowMatcher.group(3)) - ); + RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3))); } catch (Exception ignored) {} } if (!manaFound) { if (manaUseFound) { try { - RPGHud.manaPredictionUpdate( - false, - Integer.parseInt(ManaUseMatcher.group(1)) - ); + RPGHud.manaPredictionUpdate(false, Integer.parseInt(ManaUseMatcher.group(1))); } catch (Exception ignored) {} } RPGHud.manaPredictionUpdate(true, 0); |