Skip to content

Commit

Permalink
Add a setting to hide the Auto Reconnect buttons (#5072)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrParanoya authored Jan 4, 2025
1 parent 40cfef1 commit c0a3664
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.misc.AutoReconnect;
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
import net.minecraft.client.gui.screen.DisconnectedScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.DirectionalLayoutWidget;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -40,7 +40,7 @@ protected DisconnectedScreenMixin(Text title) {
private void addButtons(CallbackInfo ci) {
AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class);

if (autoReconnect.lastServerConnection != null) {
if (autoReconnect.lastServerConnection != null && !autoReconnect.button.get()) {
reconnectBtn = new ButtonWidget.Builder(Text.literal(getText()), button -> tryConnecting()).build();
grid.add(reconnectBtn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.world.ServerConnectBeginEvent;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.DoubleSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
Expand All @@ -30,6 +31,13 @@ public class AutoReconnect extends Module {
.build()
);

public final Setting<Boolean> button = sgGeneral.add(new BoolSetting.Builder()
.name("hide-buttons")
.description("Will hide the buttons related to Auto Reconnect.")
.defaultValue(false)
.build()
);

public Pair<ServerAddress, ServerInfo> lastServerConnection;

public AutoReconnect() {
Expand Down

0 comments on commit c0a3664

Please sign in to comment.