@Override
	public void keyPressed(KeyEvent e) {
		
		int keyCode = e.getKeyCode();
		SHService shService= null;

		
		try {

			shService = this.shServiceClientM.getSHService();
		}
		catch (RemoteException e1) {
			
			throw new IllegalStateException("RemoteException occured. Could not get the service to move the players on the map.", e1);
		}
		
		char action= 'x';
		try{  
			
			if (keyCode == this.commands.getRight()){
				
				action= 'r';
				shService.movePlayer(this.shServiceClientM, 'r');
			}	
		    else if (keyCode == this.commands.getLeft()){
		    	
		    	action= 'l';
		    	shService.movePlayer(this.shServiceClientM, 'l');
		    } 
			else if (keyCode == this.commands.getDown()){
				
				action= 'd';
				shService.movePlayer(this.shServiceClientM, 'd');
			} 
			else if (keyCode == this.commands.getUp()){
				
				action= 'u';
				shService.movePlayer(this.shServiceClientM, 'u');
			} 
		}
		catch(RemoteException re){
	  
			int crashedServiceIndex= this.getCrashedServiceIndex();
			List<SHService> listServices= this.getListServices();
			SHService crashedService= listServices.get(crashedServiceIndex);
			
			logger.error("Could not reach the server at the index ("+crashedServiceIndex+")");
						
			RecoveryManager recoveryManager= new RecoveryManager(this.shServiceClientM, crashedService, action);
			logger.warn("The server at ("+this.getServerHostAdress()+", "+this.getServerPort()+") became the primary.");
		}
	}