/**
* Really starts the duel after countdown
*/
public function startDuel()
{
Server::getInstance()->getScheduler()->cancelTask($this->countdownTaskHandler->getTaskId());
$player1 = $this->players[0];
$player2 = $this->players[1];
$pos_player1 = Position::fromObject($this->position, $this->position->getLevel());
$pos_player1->x += self::PLAYER_1_OFFSET_X;
$pos_player2 = Position::fromObject($this->position, $this->position->getLevel());
$pos_player2->x += self::PLAYER_2_OFFSET_X;
$player1->teleport($pos_player1, 90, 0);
$player2->teleport($pos_player2, -90, 0);
$this->sparyParticle($player1);
$this->sparyParticle($player2);
$player1->setGamemode(0);
$player2->setGamemode(0);
// Give kit
foreach ($this->players as $player) {
$this->giveKit($player);
}
// Fix start time
$this->startTime = new DateTime('now');
$player1->sendTip(OneVsOne::getMessage("duel_tip"));
$player1->sendMessage(OneVsOne::getMessage("duel_start"));
$player2->sendTip(OneVsOne::getMessage("duel_tip"));
$player2->sendMessage(OneVsOne::getMessage("duel_start"));
// Launch the end round task
$task = new RoundCheckTask(OneVsOne::getInstance());
$task->arena = $this;
$this->taskHandler = Server::getInstance()->getScheduler()->scheduleDelayedTask($task, self::ROUND_DURATION * 20);
}