@Override
	public void process(PlayerConnection pc, Object data) {

		Boolean getCardFromDeck = (Boolean) data;

		Card card = null;

		if (getCardFromDeck) {
			if (deck.isEmpty()) {
			    Card lastCard = pile.getCard();
				deck = pile;
				((Deck)deck).shuffle();
				((Pile)pile).putCard(lastCard);
			}
			card = deck.getCard();
		} else {
			card = pile.getCard();
		}

		// Update the player object
		pc.getPlayer().getHand().add(card);

		// Send card to player

		// Build event
		CharBuffer cb = Utils.buildMessage(ClientEventType.CARD, card);

		// Send to client
		try {
			pc.getOutbound().writeTextMessage(cb);
			pc.getOutbound().flush();
		} catch (IOException e) {
			e.printStackTrace();
		}

		// Update FrontEnd if taken from pile
		if (!getCardFromDeck) {
			// Tell frontend what the pile card is
	        // Build event
		    CharBuffer frontEndMessage = null;
		    if(pile.isEmpty()) {
		        // send blank card representation
		        frontEndMessage = Utils.buildMessage(ClientEventType.CARD, null);
		    } else {
		        frontEndMessage = Utils.buildMessage(ClientEventType.CARD, ((Pile)pile).peekCard());
		    }
	       
	        // Send to client
	        try {
	        	frontEndConnections.get(0).getOutbound().writeTextMessage(frontEndMessage);
	        	frontEndConnections.get(0).getOutbound().flush();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
		}

	}