public AIThread(String name, String server, String password, AIInterface ai, Status connectionstatus) {
            try {
                this.ai = ai;
                this.setName("AI-Thread for " + name);
                pfactory = new PacketFactory();
                GameNetworkInterface gn = Guice.createInjector(new GuiceConfig()).getInstance(GameNetworkInterface.class);
                gn.connectTo(server);
                pfactory.setGameNetwork(gn, name);
                this.name = pfactory.getPlayername();
                this.net = pfactory.getGameNetwork();
                net.send(new JoinGamePacket(name, password));

                IPacket p = net.receive(TIMEOUT);
                if (p instanceof PlayerJoined && ((PlayerJoinedInterface) p).getName().equals(name)) {
                    LOG.info("AI successfully connected!");
                    connectionstatus.setStatus(StatusItems.SUCCESS, "");
                } else if (p instanceof ErrorPacket) {
                    LOG.info("AI faied to connect! Reason: " + ((ErrorInterface) p).getText());
                    connectionstatus.setStatus(StatusItems.FAIL, ((ErrorInterface) p).getText());
                    net.stop();
                } else {
                    LOG.info("AI could not connect to server!");
                    connectionstatus.setStatus(StatusItems.FAIL, "Timeout");
                    net.stop();
                }
            } catch (ConnectionFailure e) {
                LOG.fatal(String.format("AI %s received %s", name, e.getMessage()));
            } catch (IOException e) {
                LOG.fatal(String.format("AI %s received %s", name, e.getMessage()));
            } catch (ClassNotFoundException e) {
                LOG.fatal(String.format("AI %s has the wrong class versions: %s", name, e.getMessage()));
            }
        }