@Override
	public void run() {
		//if(initConnection()) {
			while(connected && !socket.isClosed()) { //read in commands

				//TODO: try/catch for badly formatted commands
				Command cmd = null;
				try {
					String inputStr = in.readLine();
					if(inputStr == null) {
						System.out.println("null input");
						disconnect();
						break;
					}
					cmd = Command.parseCommand(server.getGame(), inputStr);
					server.getGame().registerPlayerCommand(this, cmd);
				} catch(IllegalMessageException e) {
					System.out.println(e);
					disconnect();
				} catch(IOException ioe) {
					disconnect();
				} catch(NoFactoryFoundException e) {
				}
			}
		//}
		System.out.println("client done");
		disconnect();
		synchronized(this) { notify(); }
	}