Fixed force disabled button

This commit is contained in:
kirillsaint 2023-08-21 18:38:20 +06:00
parent a88c8a027a
commit 91bf40612d
2 changed files with 30 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.RedButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
import net.silentclient.client.mods.Mod;
@ -58,7 +59,7 @@ public class ModSettings extends SilentScreen {
this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back"));
this.buttonList.add(new Button(2, 3, this.height - 18, mod.getCategory() == ModCategory.MODS ? 70 : 144, 15, "Reset"));
if(mod.getCategory() == ModCategory.MODS) {
this.buttonList.add(new Button(3, 76, this.height - 18, 70, 15, mod.isEnabled() ? "Enabled" : "Disabled", false, mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme()));
this.buttonList.add(new Button(3, 76, this.height - 18, 70, 15, mod.isEnabled() && !mod.isForceDisabled() ? "Enabled" : "Disabled", false, mod.isForceDisabled() ? new RedButtonTheme() : mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme()));
}
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
@ -302,6 +303,9 @@ public class ModSettings extends SilentScreen {
mod.reset(false);
break;
case 3:
if(mod.isForceDisabled()) {
break;
}
mod.toggle();
button.displayString = mod.isEnabled() ? "Enabled" : "Disabled";
if(button instanceof Button) {

View File

@ -0,0 +1,25 @@
package net.silentclient.client.gui.theme.button;
import java.awt.*;
public class RedButtonTheme implements IButtonTheme {
@Override
public Color getBorderColor() {
return new Color(229, 62, 62);
}
@Override
public Color getBackgroundColor() {
return new Color(229, 62, 62);
}
@Override
public Color getTextColor() {
return new Color(255, 255, 255);
}
@Override
public Color getHoveredBackgroundColor(int opacity) {
return new Color(229, 62, 62, opacity);
}
}