src/main/java/codes/biscuit/skyblockaddons/gui/SkyblockAddonsGui.java
/**
     * Code to perform the button toggles, openings of other guis/pages, and language changes.
     */
Code to perform the button toggles, openings of other guis/pages, and language changes.
Code to perform the button toggles openings of other guis / pages and language changes .
@Override
    protected void actionPerformed(GuiButton abstractButton) {
        if (abstractButton instanceof ButtonFeature) {
            Feature feature = ((ButtonFeature)abstractButton).getFeature();
            if (abstractButton instanceof ButtonSettings) {
                main.getUtils().setFadingIn(false);
                Minecraft.getMinecraft().displayGuiScreen(new SettingsGui(main, feature, 1, page, tab, feature.getSettings()));
                return;
            }
            if (feature == Feature.LANGUAGE) {
                main.getUtils().setFadingIn(false);
                Minecraft.getMinecraft().displayGuiScreen(new SettingsGui(main, Feature.LANGUAGE, 1, page,tab, null));
            }  else if (feature == Feature.EDIT_LOCATIONS) {
                main.getUtils().setFadingIn(false);
                Minecraft.getMinecraft().displayGuiScreen(new LocationEditGui(main, page, tab));
            }  else if (feature == Feature.GENERAL_SETTINGS) {
                if (tab == EnumUtils.GuiTab.GENERAL_SETTINGS) {
                    main.getUtils().setFadingIn(false);
                    Minecraft.getMinecraft().displayGuiScreen(new SkyblockAddonsGui(main, 1, EnumUtils.GuiTab.MAIN, featureSearchBar.getText()));
                } else {
                    main.getUtils().setFadingIn(false);
                    Minecraft.getMinecraft().displayGuiScreen(new SkyblockAddonsGui(main, 1, EnumUtils.GuiTab.GENERAL_SETTINGS, featureSearchBar.getText()));
                }
            } else if (abstractButton instanceof ButtonToggle) {
                if (main.getConfigValues().isRemoteDisabled(feature)) return;
                if (main.getConfigValues().isDisabled(feature)) {
                    main.getConfigValues().getDisabledFeatures().remove(feature);
                } else {
                    main.getConfigValues().getDisabledFeatures().add(feature);
                    if (feature == Feature.HIDE_FOOD_ARMOR_BAR) { 
                        GuiIngameForge.renderArmor = true; 
                    } else if (feature == Feature.HIDE_HEALTH_BAR) {
                        GuiIngameForge.renderHealth = true;
                    }
                }
            } else if (abstractButton instanceof ButtonSolid && feature == Feature.TEXT_STYLE) {
                main.getConfigValues().setTextStyle(main.getConfigValues().getTextStyle().getNextType());
                cancelClose = true;
                Minecraft.getMinecraft().displayGuiScreen(new SkyblockAddonsGui(main, page, tab, featureSearchBar.getText()));
                cancelClose = false;
            } else if (abstractButton instanceof ButtonModify) {
                if (feature == Feature.ADD) {
                    if (main.getConfigValues().getWarningSeconds() < 99) {
                        main.getConfigValues().setWarningSeconds(main.getConfigValues().getWarningSeconds() + 1);
                    }
                } else {
                    if (main.getConfigValues().getWarningSeconds() > 1) {
                        main.getConfigValues().setWarningSeconds(main.getConfigValues().getWarningSeconds() - 1);
                    }
                }
            } else if (abstractButton instanceof ButtonCredit) {
                if (main.getConfigValues().isRemoteDisabled(feature)) return;
                EnumUtils.FeatureCredit credit = ((ButtonCredit)abstractButton).getCredit();
                try {
                    Desktop.getDesktop().browse(new URI(credit.getUrl()));
                } catch (Exception ignored) {}
            }
        } else if (abstractButton instanceof ButtonArrow) {
            ButtonArrow arrow = (ButtonArrow)abstractButton;
            if (arrow.isNotMax()) {
                main.getUtils().setFadingIn(false);
                if (arrow.getArrowType() == ButtonArrow.ArrowType.RIGHT) {
                    mc.displayGuiScreen(new SkyblockAddonsGui(main, ++page, tab, featureSearchBar.getText()));
                } else {
                    mc.displayGuiScreen(new SkyblockAddonsGui(main, --page, tab, featureSearchBar.getText()));
                }
            }
        } else if (abstractButton instanceof ButtonSwitchTab) {
            ButtonSwitchTab tab = (ButtonSwitchTab)abstractButton;
            if (tab.getTab() != this.tab) {
                main.getUtils().setFadingIn(false);
                mc.displayGuiScreen(new SkyblockAddonsGui(main, 1, tab.getTab(), featureSearchBar.getText()));
            }
        } else if (abstractButton instanceof ButtonSocial) {
            EnumUtils.Social social = ((ButtonSocial)abstractButton).getSocial();
            try {
                Desktop.getDesktop().browse(social.getUrl());
            } catch (Exception ignored) {}
        } else if (abstractButton instanceof ButtonBanner) {
            try {
                Desktop.getDesktop().browse(main.getUtils().getFeaturedURL());
            } catch (Exception ignored) {}
        }
    }
@ Override protected void actionPerformed ( GuiButton abstractButton ) { if ( abstractButton instanceof ButtonFeature ) { Feature feature = ( ( ButtonFeature ) abstractButton ) . getFeature ( ) ; if ( abstractButton instanceof ButtonSettings ) { main . getUtils ( ) . setFadingIn ( false ) ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new SettingsGui ( main , feature , 1 , page , tab , feature . getSettings ( ) ) ) ; return ; } if ( feature == Feature . LANGUAGE ) { main . getUtils ( ) . setFadingIn ( false ) ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new SettingsGui ( main , Feature . LANGUAGE , 1 , page , tab , null ) ) ; } else if ( feature == Feature . EDIT_LOCATIONS ) { main . getUtils ( ) . setFadingIn ( false ) ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new LocationEditGui ( main , page , tab ) ) ; } else if ( feature == Feature . GENERAL_SETTINGS ) { if ( tab == EnumUtils . GuiTab . GENERAL_SETTINGS ) { main . getUtils ( ) . setFadingIn ( false ) ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new SkyblockAddonsGui ( main , 1 , EnumUtils . GuiTab . MAIN , featureSearchBar . getText ( ) ) ) ; } else { main . getUtils ( ) . setFadingIn ( false ) ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new SkyblockAddonsGui ( main , 1 , EnumUtils . GuiTab . GENERAL_SETTINGS , featureSearchBar . getText ( ) ) ) ; } } else if ( abstractButton instanceof ButtonToggle ) { if ( main . getConfigValues ( ) . isRemoteDisabled ( feature ) ) return ; if ( main . getConfigValues ( ) . isDisabled ( feature ) ) { main . getConfigValues ( ) . getDisabledFeatures ( ) . remove ( feature ) ; } else { main . getConfigValues ( ) . getDisabledFeatures ( ) . add ( feature ) ; if ( feature == Feature . HIDE_FOOD_ARMOR_BAR ) { GuiIngameForge . renderArmor = true ; } else if ( feature == Feature . HIDE_HEALTH_BAR ) { GuiIngameForge . renderHealth = true ; } } } else if ( abstractButton instanceof ButtonSolid && feature == Feature . TEXT_STYLE ) { main . getConfigValues ( ) . setTextStyle ( main . getConfigValues ( ) . getTextStyle ( ) . getNextType ( ) ) ; cancelClose = true ; Minecraft . getMinecraft ( ) . displayGuiScreen ( new SkyblockAddonsGui ( main , page , tab , featureSearchBar . getText ( ) ) ) ; cancelClose = false ; } else if ( abstractButton instanceof ButtonModify ) { if ( feature == Feature . ADD ) { if ( main . getConfigValues ( ) . getWarningSeconds ( ) < 99 ) { main . getConfigValues ( ) . setWarningSeconds ( main . getConfigValues ( ) . getWarningSeconds ( ) + 1 ) ; } } else { if ( main . getConfigValues ( ) . getWarningSeconds ( ) > 1 ) { main . getConfigValues ( ) . setWarningSeconds ( main . getConfigValues ( ) . getWarningSeconds ( ) - 1 ) ; } } } else if ( abstractButton instanceof ButtonCredit ) { if ( main . getConfigValues ( ) . isRemoteDisabled ( feature ) ) return ; EnumUtils . FeatureCredit credit = ( ( ButtonCredit ) abstractButton ) . getCredit ( ) ; try { Desktop . getDesktop ( ) . browse ( new URI ( credit . getUrl ( ) ) ) ; } catch ( Exception ignored ) { } } } else if ( abstractButton instanceof ButtonArrow ) { ButtonArrow arrow = ( ButtonArrow ) abstractButton ; if ( arrow . isNotMax ( ) ) { main . getUtils ( ) . setFadingIn ( false ) ; if ( arrow . getArrowType ( ) == ButtonArrow . ArrowType . RIGHT ) { mc . displayGuiScreen ( new SkyblockAddonsGui ( main , ++ page , tab , featureSearchBar . getText ( ) ) ) ; } else { mc . displayGuiScreen ( new SkyblockAddonsGui ( main , -- page , tab , featureSearchBar . getText ( ) ) ) ; } } } else if ( abstractButton instanceof ButtonSwitchTab ) { ButtonSwitchTab tab = ( ButtonSwitchTab ) abstractButton ; if ( tab . getTab ( ) != this . tab ) { main . getUtils ( ) . setFadingIn ( false ) ; mc . displayGuiScreen ( new SkyblockAddonsGui ( main , 1 , tab . getTab ( ) , featureSearchBar . getText ( ) ) ) ; } } else if ( abstractButton instanceof ButtonSocial ) { EnumUtils . Social social = ( ( ButtonSocial ) abstractButton ) . getSocial ( ) ; try { Desktop . getDesktop ( ) . browse ( social . getUrl ( ) ) ; } catch ( Exception ignored ) { } } else if ( abstractButton instanceof ButtonBanner ) { try { Desktop . getDesktop ( ) . browse ( main . getUtils ( ) . getFeaturedURL ( ) ) ; } catch ( Exception ignored ) { } } }
Code to perform the button toggles, openings of other guis/pages, and language changes.
Code to perform the button toggles openings of other guis / pages and language changes .
// Reset the vanilla bars when disabling these two features. // The food gets automatically enabled, no need to include it.