public void joinGame(Packet p)
    {
        System.out.println("in join");
        String xml = "";
        int max = 0;
        if(!checkPlayerId(p.getPlayerId(), p.getName()))
        {
            notifyThis("Chyba: hrac se stejnym poradovim cislem jiz ve hre existuje");
            try {
                this.out.close();
                this.in.close();
                this.socket.close();
                clients.remove(this);
            } catch (IOException ex) {
                Logger.getLogger(ClientThread.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        for(int j = 0; j < clients.size(); j++)
        {
            ClientThread i = clients.get(j);
            if(i.gameName.equals(p.getName()) && i != this)
            {
                xml = i.XML;
                max = i.maxPlayers;
                break;
            }
        }
        System.out.println("max: " + max);
        if(clientCounter(p.getName()) > max || xml.equals(""))
        {
            if(xml.equals(""))
            {
                notifyThis("Chyba: hra neexistuje");
            }
            else
            {
                notifyThis("Chyba: hra je plna");
                try {
                    this.out.close();
                    this.in.close();
                    this.socket.close();
                    clients.remove(this);
                } catch (IOException ex) {
                    Logger.getLogger(ClientThread.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        else
        {
            this.XML = xml;
            this.gameName = p.getName();
            this.player = p.getPlayerId();
            this.maxPlayers = max;
        }
        
    }