/** * Handles the move put from a Client. * * @param params is a String array containing the blocks to place */ public void doMovePut(String[] params) { Map<Point, Block> moves = new HashMap<>(); for (String move : params) { String[] moveArg = move.split("@"); int blockId = Integer.parseInt(moveArg[0]); int moveX = Integer.parseInt(moveArg[1].split(",")[0]); int moveY = Integer.parseInt(moveArg[1].split(",")[1]); moves.put(new Point(moveX, moveY), new Block(blockId)); } try { game.doMovePut(moves); System.out.println("[Server] (ClientHandler) - Current game situation:"); System.out.println(game.getBoard().toString()); } catch (InvalidMoveException e) { sendError(IProtocol.Error.MOVE_INVALID.ordinal() + " Invalid move"); game.sendPlayerTurn(); } catch (TilesUnownedException e) { sendError( IProtocol.Error.MOVE_TILES_UNOWNED.ordinal() + " Player tried to place unowned tile"); game.sendPlayerTurn(); } catch (NullPointerException e) { System.out.println("[Server] ClientHandler - Game ended during turn."); } }