@Override
    public void run() {
        try {
            while (run) {
                String message = din.readUTF();
                switch (Integer.parseInt(message.substring(0, 1))) {
                    case 1:
                        gui.displayMessage(message.substring(1), ChatGUI.INCOMMINGMESSAGE);
                        break;
                    case 2:
                        gui.displayMessage(message.substring(1) + " has connected.", ChatGUI.MESSAGE);
                        break;
                    case 3:
                        gui.displayMessage(message.substring(1) + " has disconnected.", ChatGUI.MESSAGE);
                        break;
                    case 4:
                        gui.displayMessage(message.substring(1) + " has been banned.", ChatGUI.MESSAGE);
                        break;
                    case 5:
                        gui.displayMessage(message.substring(1), ChatGUI.MESSAGE);
                        break;
                    case 6:
                        auth = true;
                        break;
                    case 7:
                        disconnect();
                        break;
                }
            }
        } catch (IOException ie) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ie);
        }
    }