<commit_before>package com.chess.rathma.Screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.chess.rathma.Chess;
import com.chess.rathma.Packets.IdentPacket;

import java.io.IOException;


public class LoginScreen implements Screen {
    private Chess chess;
    private Skin skin;
    private Table table;
    private Stage stage;
    public boolean lock=true;
    public LoginScreen(Chess chess)
    {
        this.chess = chess;
    }

    @Override
    public void show() {
        /* Basic things we need */
        stage = new Stage(new ScreenViewport());
        skin = new Skin(Gdx.files.internal("menu.json"));
        table = new Table(skin);
        Gdx.input.setInputProcessor(stage);

        /* Let's change the size of the window, since we don't have much to fill the empty space */
        Label userLabel = new Label("Username: ", skin);
        Label passwordLabel = new Label("Password: ",skin);
        final Label serverLabel = new Label("Server: ", skin);

        final TextField userTextField = new TextField("",skin);
        final TextField passwordTextField = new TextField("",skin);
        passwordTextField.setMessageText("Disabled!");
        final TextField serverTextField = new TextField("",skin);

        passwordTextField.setPasswordMode(true);
        passwordTextField.setPasswordCharacter('*');
        passwordTextField.setDisabled(true);

        TextButton connectButton = new TextButton("Connect!", skin);

        /* Setting up our events !*/
        connectButton.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                try {
                    if(!chess.network.isConnected())
                    {
                        chess.network.connect(5000,serverTextField.getText(),7667);
                        if(chess.network.isConnected()) {
                            serverTextField.setDisabled(true);
                            chess.network.sendTCP(new IdentPacket(userTextField.getText()));
                        }
                    }
                    else {
                        chess.network.sendTCP(new IdentPacket(userTextField.getText()));
                    }
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        });





        stage.addActor(table);<commit_msg>Quick change to the default server settings<commit_after>package com.chess.rathma.Screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.chess.rathma.Chess;
import com.chess.rathma.Packets.IdentPacket;

import java.io.IOException;


public class LoginScreen implements Screen {
    private Chess chess;
    private Skin skin;
    private Table table;
    private Stage stage;
    public boolean lock=true;
    public LoginScreen(Chess chess)
    {
        this.chess = chess;
    }

    @Override
    public void show() {
        /* Basic things we need */
        stage = new Stage(new ScreenViewport());
        skin = new Skin(Gdx.files.internal("menu.json"));
        table = new Table(skin);
        Gdx.input.setInputProcessor(stage);

        /* Let's change the size of the window, since we don't have much to fill the empty space */
        Label userLabel = new Label("Username: ", skin);
        Label passwordLabel = new Label("Password: ",skin);
        final Label serverLabel = new Label("Server: ", skin);

        final TextField userTextField = new TextField("",skin);
        final TextField passwordTextField = new TextField("",skin);
        final TextField serverTextField = new TextField("",skin);

        /* Setting up our text fields */
        passwordTextField.setMessageText("Disabled!");
        passwordTextField.setPasswordMode(true);
        passwordTextField.setPasswordCharacter('*');
        passwordTextField.setDisabled(true);


        serverTextField.setText("Chess Network");

        TextButton connectButton = new TextButton("Connect!", skin);

        /* Setting up our events !*/
        connectButton.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                try {
                    if(!chess.network.isConnected())
                    {
                        if(serverTextField.getText().equals("Chess Network")) {
                            chess.network.connect(5000, "fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b", 7667);
                            if (chess.network.isConnected()) {
                                serverTextField.setDisabled(true);
                                chess.network.sendTCP(new IdentPacket(userTextField.getText()));
                            }
                        }
                        else {
                            chess.network.connect(5000, serverTextField.getText(), 7667);
                            if (chess.network.isConnected()) {
                                serverTextField.setDisabled(true);
                                chess.network.sendTCP(new IdentPacket(userTextField.getText()));
                            }
                        }

                    }
                    else {
                        chess.network.sendTCP(new IdentPacket(userTextField.getText()));
                    }
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
        });





        stage.addActor(table);
{'fraction_non_alphanumeric': 0.10281975385574077, 'fraction_numerical': 0.009191462844679857, 'mean_word_length': 2.0254476908576815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7583481', 'n_tokens_mistral': 1789, 'n_tokens_neox': 1664, 'n_words': 344}