@Override public void moveShip(Integer shipId, String planetName) { Ship ship = shipRepository.getShipByShipId(shipId); Game game = ship.getPlayer().getGame(); Planet destinationPlanet = planetRepository.getPlanetByName(planetName); validateActionMakeSureGameIsNotFinishedYet(game); moveShipHandler.validateMove(ship, destinationPlanet); moveShipHandler.moveShip(ship, destinationPlanet); checkLost(game); gameSynchronizer.updateGame(game); }
@Override public Planet getShipLocationByShipId(int shipId) { Ship shipDb = shipRepository.getShipByShipId(shipId); return shipDb.getPlanet(); }