reconnect crash fix & auto sign
This commit is contained in:
committed by
Cloudburst
parent
e7de14cd03
commit
e7c81710a8
@@ -2,13 +2,11 @@ package anticope.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.misc.AutoReconnect;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
@@ -21,10 +19,12 @@ public class ReconnectCommand extends Command {
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(context -> {
|
||||
mc.world.disconnect();
|
||||
AutoReconnect autoReconnect = Modules.get().get(AutoReconnect.class);
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), MinecraftClient.getInstance(),
|
||||
ServerAddress.parse(autoReconnect.lastServerInfo.address), autoReconnect.lastServerInfo);
|
||||
ServerInfo info = mc.isInSingleplayer() ? null : mc.getCurrentServerEntry();
|
||||
if (info != null) {
|
||||
mc.world.disconnect();
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc,
|
||||
ServerAddress.parse(info.address), info);
|
||||
}
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user