/**
  * @param \Likedimion\Tools\Helper\PlayerDataHelper $playerData
  * @throws \Likedimion\Exception\RegistrationException
  * @return Player
  */
 public function createPlayer(PlayerDataHelper $playerData)
 {
     try {
         $findPlayer = $this->playerService->getRepository()->findPlayerByName($playerData->name);
         throw new RegistrationException("player_name_exists");
     } catch (EntityNotFoundException $e) {
         $player = new Player();
         $player->setName($playerData->name);
         $player->setSex($playerData->sex);
         $player->setClass($playerData->class);
         $player->setRace($playerData->race);
         $stats = $player->getStats();
         $cfg = Game::getInstance()->getConfig();
         $stats->setStrenge($cfg["new_player"][$player->getClass()]["str"]);
         $stats->setDexterity($cfg["new_player"][$player->getClass()]["dex"]);
         $stats->setIntelligence($cfg["new_player"][$player->getClass()]["int"]);
         $stats->setSpirituality($cfg["new_player"][$player->getClass()]["spr"]);
         $stats->setEndurance($cfg["new_player"][$player->getClass()]["end"]);
         $player->setStats($stats);
         $this->playerCalculatingService->calculate($player);
         $this->playerService->getRepository()->save($player);
         $account = $this->authService->getAccount(Game::getInstance()->getAuthToken()->getValue());
         $player->setAccount($account);
         $this->accountService->getRepository()->save($account);
         $this->playerService->getRepository()->save($player);
         return $player;
     }
 }
 /**
  * @param string $name
  * @param int $sex
  * @param int $class
  * @return Player
  */
 public function createPlayer($name, $sex, $class)
 {
     $account = $this->authService->getAccount(Game::getInstance()->getAuthToken()->getValue());
     $player = new Player();
     $statistic = new PlayerStatistic();
     $player->setAccount($account);
     $player->setName($name);
     $player->setStatistic($statistic);
     $player->setSex($sex);
     $player->setClass($class);
     $this->getRepository()->save($player);
 }