src/main/java/codes/biscuit/skyblockaddons/listeners/PlayerListener.java
/**
     * Interprets the action bar to extract mana, health, and defence. Enables/disables mana/health prediction,
     * and looks for mana usage messages in chat while predicting.
     */
Interprets the action bar to extract mana, health, and defence. Enables/disables mana/health prediction,
and looks for mana usage messages in chat while predicting.
Interprets the action bar to extract mana health and defence . Enables / disables mana / health prediction and looks for mana usage messages in chat while predicting .
@SubscribeEvent(priority = EventPriority.HIGH)
    public void onChatReceive(ClientChatReceivedEvent e) {
        String message = e.message.getUnformattedText();
        if (e.type == 2) {
            String restMessage = actionBarParser.parseActionBar(message);
            if (main.isUsingOofModv1() && restMessage.trim().length() == 0) {
                e.setCanceled(true);
            }
            e.message = new ChatComponentText(restMessage);
        } else {
            final String formattedText = e.message.getFormattedText();
            if (main.getRenderListener().isPredictMana() && message.startsWith("Used ") && message.endsWith("Mana)")) {
                int manaLost = Integer.parseInt(message.split(Pattern.quote("! ("))[1].split(Pattern.quote(" Mana)"))[0]);
                changeMana(-manaLost);
            }
            /*  Resets all user input on dead as to not walk backwards or stafe into the portal
                Might get trigger upon encountering a non named "You" though this chance is so
                minimal it can be discarded as a bug. */
            if (main.getConfigValues().isEnabled(Feature.PREVENT_MOVEMENT_ON_DEATH) && formattedText.startsWith("§r§c \u2620 §r§7You ")) {
                KeyBinding.unPressAllKeys();
            }
            if (main.getConfigValues().isEnabled(Feature.SUMMONING_EYE_ALERT) && formattedText.equals("§r§6§lRARE DROP! §r§5Summoning Eye§r")) {
                main.getUtils().playLoudSound("random.orb", 0.5);
                main.getRenderListener().setTitleFeature(Feature.SUMMONING_EYE_ALERT);
                main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
            } else if (formattedText.equals("§r§aA special §r§5Zealot §r§ahas spawned nearby!§r")) {
                if (main.getConfigValues().isEnabled(Feature.SPECIAL_ZEALOT_ALERT)) {
                    main.getUtils().playLoudSound("random.orb", 0.5);
                    main.getRenderListener().setTitleFeature(Feature.SUMMONING_EYE_ALERT);
                    main.getRenderListener().setTitleFeature(Feature.SPECIAL_ZEALOT_ALERT);
                    main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
                }
                if (main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER)) {
                    e.message = new ChatComponentText(e.message.getFormattedText() + ChatFormatting.GRAY + " (" + main.getPersistentValues().getKills() + ")");
                    main.getPersistentValues().setKills(-1); 
                }
            }
            if (main.getConfigValues().isEnabled(Feature.DISABLE_MAGICAL_SOUP_MESSAGES) && randomMessages.contains(message)) {
                e.setCanceled(true);
            }
            if (main.getConfigValues().isEnabled(Feature.NO_ARROWS_LEFT_ALERT)) {
                if (formattedText.equals("§r§cYou don't have any more Arrows left in your Quiver!§r")) {
                    main.getUtils().playLoudSound("random.orb", 0.5);
                    main.getRenderListener().setSubtitleFeature(Feature.NO_ARROWS_LEFT_ALERT);
                    main.getScheduler().schedule(Scheduler.CommandType.RESET_SUBTITLE_FEATURE, main.getConfigValues().getWarningSeconds());
                } else if (formattedText.startsWith("§r§cYou only have") && formattedText.endsWith("Arrows left in your Quiver!§r")) {
                    int arrowsLeft = Integer.parseInt(main.getUtils().getNumbersOnly(formattedText).trim());
                    main.getUtils().playLoudSound("random.orb", 0.5);
                    main.getRenderListener().setSubtitleFeature(Feature.NO_ARROWS_LEFT_ALERT);
                    main.getRenderListener().setArrowsLeft(arrowsLeft);
                    main.getScheduler().schedule(Scheduler.CommandType.RESET_SUBTITLE_FEATURE, main.getConfigValues().getWarningSeconds());
                }
            }
            Matcher matcher = ABILITY_CHAT_PATTERN.matcher(e.message.getFormattedText());
            if (matcher.matches()) {
                CooldownManager.put(Minecraft.getMinecraft().thePlayer.getHeldItem());
            } else {
                matcher = PROFILE_CHAT_PATTERN.matcher(e.message.getFormattedText());
                if (matcher.matches()) {
                    main.getUtils().setProfileName(matcher.group(1));
                } else {
                    matcher = SWITCH_PROFILE_CHAT_PATTERN.matcher(e.message.getFormattedText());
                    if (matcher.matches()) {
                        main.getUtils().setProfileName(matcher.group(1));
                    }
                }
            }
        }
    }
@ SubscribeEvent ( priority = EventPriority . HIGH ) public void onChatReceive ( ClientChatReceivedEvent e ) { String message = e . message . getUnformattedText ( ) ; if ( e . type == 2 ) { String restMessage = actionBarParser . parseActionBar ( message ) ; if ( main . isUsingOofModv1 ( ) && restMessage . trim ( ) . length ( ) == 0 ) { e . setCanceled ( true ) ; } e . message = new ChatComponentText ( restMessage ) ; } else { final String formattedText = e . message . getFormattedText ( ) ; if ( main . getRenderListener ( ) . isPredictMana ( ) && message . startsWith ( "Used " ) && message . endsWith ( "Mana)" ) ) { int manaLost = Integer . parseInt ( message . split ( Pattern . quote ( "! (" ) ) [ 1 ] . split ( Pattern . quote ( " Mana)" ) ) [ 0 ] ) ; changeMana ( - manaLost ) ; } /*  Resets all user input on dead as to not walk backwards or stafe into the portal
                Might get trigger upon encountering a non named "You" though this chance is so
                minimal it can be discarded as a bug. */ if ( main . getConfigValues ( ) . isEnabled ( Feature . PREVENT_MOVEMENT_ON_DEATH ) && formattedText . startsWith ( "§r§c \u2620 §r§7You ")) { KeyBinding . unPressAllKeys ( ) ; } if ( main . getConfigValues ( ) . isEnabled ( Feature . SUMMONING_EYE_ALERT ) && formattedText . equals ( "§r§6§lRARE DROP! §r§5Summoning Eye§r")) { main . getUtils ( ) . playLoudSound ( "random.orb" , 0.5 ) ; main . getRenderListener ( ) . setTitleFeature ( Feature . SUMMONING_EYE_ALERT ) ; main . getScheduler ( ) . schedule ( Scheduler . CommandType . RESET_TITLE_FEATURE , main . getConfigValues ( ) . getWarningSeconds ( ) ) ; } else if ( formattedText . equals ( "§r§aA special §r§5Zealot §r§ahas spawned nearby!§r")) { if ( main . getConfigValues ( ) . isEnabled ( Feature . SPECIAL_ZEALOT_ALERT ) ) { main . getUtils ( ) . playLoudSound ( "random.orb" , 0.5 ) ; main . getRenderListener ( ) . setTitleFeature ( Feature . SUMMONING_EYE_ALERT ) ; main . getRenderListener ( ) . setTitleFeature ( Feature . SPECIAL_ZEALOT_ALERT ) ; main . getScheduler ( ) . schedule ( Scheduler . CommandType . RESET_TITLE_FEATURE , main . getConfigValues ( ) . getWarningSeconds ( ) ) ; } if ( main . getConfigValues ( ) . isEnabled ( Feature . ZEALOT_COUNTER ) ) { e . message = new ChatComponentText ( e . message . getFormattedText ( ) + ChatFormatting . GRAY + " (" + main . getPersistentValues ( ) . getKills ( ) + ")" ) ; main . getPersistentValues ( ) . setKills ( - 1 ) ; } } if ( main . getConfigValues ( ) . isEnabled ( Feature . DISABLE_MAGICAL_SOUP_MESSAGES ) && randomMessages . contains ( message ) ) { e . setCanceled ( true ) ; } if ( main . getConfigValues ( ) . isEnabled ( Feature . NO_ARROWS_LEFT_ALERT ) ) { if ( formattedText . equals ( "§r§cYou don't have any more Arrows left in your Quiver!§r"))  { main . getUtils ( ) . playLoudSound ( "random.orb" , 0.5 ) ; main . getRenderListener ( ) . setSubtitleFeature ( Feature . NO_ARROWS_LEFT_ALERT ) ; main . getScheduler ( ) . schedule ( Scheduler . CommandType . RESET_SUBTITLE_FEATURE , main . getConfigValues ( ) . getWarningSeconds ( ) ) ; } else if ( formattedText . startsWith ( "§r§cYou only have")  &  f rmattedText.e n dsWith(" A rrows left in your Quiver!§r"))  { int arrowsLeft = Integer . parseInt ( main . getUtils ( ) . getNumbersOnly ( formattedText ) . trim ( ) ) ; main . getUtils ( ) . playLoudSound ( "random.orb" , 0.5 ) ; main . getRenderListener ( ) . setSubtitleFeature ( Feature . NO_ARROWS_LEFT_ALERT ) ; main . getRenderListener ( ) . setArrowsLeft ( arrowsLeft ) ; main . getScheduler ( ) . schedule ( Scheduler . CommandType . RESET_SUBTITLE_FEATURE , main . getConfigValues ( ) . getWarningSeconds ( ) ) ; } } Matcher matcher = ABILITY_CHAT_PATTERN . matcher ( e . message . getFormattedText ( ) ) ; if ( matcher . matches ( ) ) { CooldownManager . put ( Minecraft . getMinecraft ( ) . thePlayer . getHeldItem ( ) ) ; } else { matcher = PROFILE_CHAT_PATTERN . matcher ( e . message . getFormattedText ( ) ) ; if ( matcher . matches ( ) ) { main . getUtils ( ) . setProfileName ( matcher . group ( 1 ) ) ; } else { matcher = SWITCH_PROFILE_CHAT_PATTERN . matcher ( e . message . getFormattedText ( ) ) ; if ( matcher . matches ( ) ) { main . getUtils ( ) . setProfileName ( matcher . group ( 1 ) ) ; } } } } }
Interprets the action bar to extract mana, health, and defence.
Interprets the action bar to extract mana health and defence .
// action bar message, parse using ActionBarParser and display the rest message instead // credits to tomotomo, thanks lol // Edit the message to include counter. // This is triggered before the death of the killed zealot, so this is set to -1 to account for that. // THIS IS IMPORTANT