public void run(){
		boolean running = true;		
		while(running){
			Message message = null;
	        try {
	        	if(socket.isConnected()){
					while((message = ((Message) in.readObject())) != null){
						switch(message.getType()){
						case TEXT:
							gameHandler.sendMessage(message);
							break;
						case HELLO:
							gameHandler.sendMessage(new Message(message, MessageType.TEXT));
							name = message.getName();
							break;
						case BYE:
							gameHandler.sendMessage(message);
							gameHandler.playerLeft(this);
							running = false;
							break;
						case MOVE:
							gameHandler.sendMessage(message);
							break;
						}
					}
	        	}
	        } catch (Exception e) {
				try {
					socket.close();
				} catch (IOException e1) {
					System.err.println("PlayerHandler for " + name + "Couldn't close client socket!");
					break;
				}
			}
		}
	}