Ejemplo n.º 1
0
 public function process()
 {
     $o = new Object();
     $o->setUserId($this->datas['user_id']);
     $o->setUserName($this->datas['user_name']);
     $o->setUserTeam($this->datas['user_team']);
     $o->setUserSteamid($this->datas['steam_id']);
     $o->setText($this->datas['text']);
     $o->setType(Object::SAY);
     return $o;
 }
Ejemplo n.º 2
0
 /**
  * Processing say message
  * Made action with the message
  * Dispatch a Say event
  * @param \eBot\Message\Type\Say $message
  */
 private function processSay(\eBot\Message\Type\Say $message)
 {
     Logger::debug("Processing Say Message");
     $user = $this->processPlayer($message->getUserId(), $message->getUserName(), $message->getUserTeam(), $message->getUserSteamid());
     $text = trim($message->getText());
     if (preg_match('/\\!map (?<mapname>.*)/i', $text, $preg)) {
         if (!$this->mapIsEngaged && ($this->getStatus() == self::STATUS_WU_KNIFE && $this->config_kniferound || $this->getStatus() == self::STATUS_WU_1_SIDE && !$this->config_kniferound)) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") wants to play " . $preg['mapname']);
             Logger::log($message->getUserName() . " (" . $message->getUserTeam() . ") wants to play " . $preg['mapname']);
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 $maps = \eBot\Config\Config::getInstance()->getMaps();
                 if (in_array($preg['mapname'], $maps)) {
                     $this->playMap['ct'] = $preg['mapname'];
                     $this->say($team . " (CT) wants to play " . $preg['mapname']);
                 } else {
                     $this->say($preg['mapname'] . " was not found! Available maps are:");
                     foreach ($maps as $map) {
                         $mapmessage .= "{$map}, ";
                     }
                     $this->say(substr($mapmessage, 0, -2));
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 $maps = \eBot\Config\Config::getInstance()->getMaps();
                 if (in_array($preg['mapname'], $maps)) {
                     $this->playMap['t'] = $preg['mapname'];
                     $this->say($team . " (T) wants to play " . $preg['mapname']);
                 } else {
                     $this->say($preg['mapname'] . " was not found! Available maps are:");
                     foreach ($maps as $map) {
                         $mapmessage .= "{$map}, ";
                     }
                     $this->say(substr($mapmessage, 0, -2));
                 }
             }
             $this->setMatchMap($preg['mapname']);
         } else {
             $this->addLog("Veto isn't enabled");
         }
     } elseif ($text == "!stats") {
         $this->addLog($message->getUserName() . " ask his stats");
         if ($user) {
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: stats pour " . $message->userName . "\"");
             if ($user->get("death") == 0) {
                 $ratio = $user->get("kill");
             } else {
                 $ratio = round($user->get("kill") / $user->get("death"), 2);
             }
             if ($user->get("kill") == 0) {
                 $ratiohs = 0;
             } else {
                 $ratiohs = round($user->get("hs") / $user->get("kill") * 100, 2);
             }
             $this->rcon->send("csay_to_player " . $message->userId . " \" Kill: " . $user->get("kill") . " - HS: " . $user->get("hs") . "\"");
             $this->rcon->send("csay_to_player " . $message->userId . " \" Death: " . $user->get("death") . " - Score: " . $user->get("point") . "\"");
             $this->rcon->send("csay_to_player " . $message->userId . " \" Ratio K/D: " . $ratio . " - HS%: " . $ratiohs . "\"");
         } else {
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: pas de stats pour le moment pour " . $message->userName . "\"");
         }
     } elseif ($text == "!morestats") {
         $this->addLog($message->getUserName() . " ask more stats");
         if ($user) {
             $this->rcon->send('csay_to_player ' . $message->userId . " \"eBot: stats pour " . $message->userName . "\"");
             $stats = array();
             for ($i = 1; $i <= 5; $i++) {
                 if ($user->get("v{$i}") > 0) {
                     $stats[] = array("name" => "1v{$i}", "val" => $user->get("v{$i}"));
                 }
                 if ($user->get("k{$i}") > 0) {
                     $stats[] = array("name" => $i . " kill/round", "val" => $user->get("k{$i}"));
                 }
             }
             if ($user->get("bombe") > 0) {
                 $stats[] = array("name" => "Bombe", "val" => $user->get("bombe"));
             }
             if ($user->get("defuse") > 0) {
                 $stats[] = array("name" => "Defuse", "val" => $user->get("defuse"));
             }
             if ($user->get("tk") > 0) {
                 $stats[] = array("name" => "TK", "val" => $user->get("tk"));
             }
             if ($user->get("firstKill") > 0) {
                 $stats[] = array("name" => "First Kill", "val" => $user->get("firstKill"));
             }
             $messageText = "";
             $count = 0;
             $doit = true;
             foreach ($stats as $v) {
                 $count++;
                 $doit = false;
                 if ($messageText == "") {
                     $messageText = " " . $v["name"] . ": " . $v["val"];
                 } else {
                     $messageText .= " - " . $v["name"] . ": " . $v["val"];
                 }
                 if ($count == 2) {
                     $this->rcon->send('csay_to_player ' . $message->userId . ' "' . $messageText . '"');
                     $messageText = "";
                     $count = 0;
                 }
             }
             if ($count > 0) {
                 $this->rcon->send('csay_to_player ' . $message->userId . ' "' . $messageText . '"');
             }
             if ($doit) {
                 $this->rcon->send('csay_to_player ' . $message->userId . " \"eBot: Pas de stats pour le moment\"");
             }
         } else {
             $this->rcon->send('csay_to_player ' . $message->userId . " \"eBot: Pas de stats pour le moment pour " . $message->userName . '"');
         }
     } elseif ($text == "!rules") {
         if ($this->pluginCsay) {
             $this->addLog($message->getUserName() . " ask rules");
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: Full Score: " . ($this->config_full_score ? "yes" : "no") . " :: Switch Auto: " . ($this->config_switch_auto ? "yes" : "no") . "\"");
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: Over Time: " . ($this->config_ot ? "yes" : "no") . " :: MaxRound: " . $this->maxRound . "\"");
         }
     } elseif ($text == "!help") {
         if ($this->pluginCsay) {
             $this->addLog($message->getUserName() . " ask help");
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: commands available: !help, !status, !stats, !morestats, !score, !ready, !notready, !stop, !restart (for knife round), !stay, !switch\"");
         }
     } elseif ($text == "!restart") {
         $this->addLog($message->getUserName() . " say restart");
         if ($this->getStatus() == self::STATUS_KNIFE || $this->getStatus() == self::STATUS_END_KNIFE) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->restart['ct']) {
                     $this->restart['ct'] = true;
                     $this->say($team . " (CT) want to restart the knife");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->restart['t']) {
                     $this->restart['t'] = true;
                     $this->say($team . " (T) want to restart the knife");
                 }
             }
             if ($this->restart["ct"] && $this->restart["t"]) {
                 $this->ready["ct"] = true;
                 $this->ready["t"] = true;
                 $this->setStatus(self::STATUS_WU_KNIFE);
                 $this->currentMap->setStatus(Map::STATUS_WU_KNIFE);
                 $this->restart["ct"] = false;
                 $this->restart["ct"] = false;
                 $this->addMatchLog("Restarting knife");
                 $this->addLog("Restarting knife");
                 $this->startMatch(true);
             }
         }
     } elseif (($text == "!stop" || $text == ".stop") && !\eBot\Config\Config::getInstance()->getConfigStopDisabled()) {
         if ($this->isMatchRound() && $this->enable) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say stop");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->stop['ct']) {
                     $this->stop['ct'] = true;
                     $this->say($team . " (CT) want to stop");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->stop['t']) {
                     $this->stop['t'] = true;
                     $this->say($team . " (T) want to stop");
                 }
             }
             $this->stopMatch();
         } else {
             if (!$this->enable) {
                 $this->addLog("Can't stop, it's already stop");
             }
         }
     } elseif ($text == "!continue" || $text == ".continue") {
         if ($this->isMatchRound() && !$this->enable) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->continue['ct']) {
                     $this->continue['ct'] = true;
                     $this->say($team . " (CT) want to go live");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->continue['t']) {
                     $this->continue['t'] = true;
                     $this->say($team . " (T) want to go live");
                 }
             }
             $this->continueMatch();
         }
     } elseif ($text == "!ready" || $text == ".ready") {
         if ($this->isWarmupRound() && $this->mapIsEngaged) {
             if ($this->config_streamer && !$this->getStreamerReady()) {
                 $this->say("Streamers are not ready yet.");
                 $this->say("Please wait, till they are ready.");
             } else {
                 $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say ready");
                 if ($message->getUserTeam() == "CT") {
                     if ($this->getStatus() == self::STATUS_WU_2_SIDE || $this->getStatus() == self::STATUS_WU_OT_2_SIDE) {
                         $team = $this->side['team_a'] == "ct" ? $this->teamBName : $this->teamAName;
                     } else {
                         $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                     }
                     if (!$this->ready['ct']) {
                         $this->ready['ct'] = true;
                         $this->say($team . " (CT) is now ready");
                     } else {
                         $this->say($team . " (CT) is already ready");
                     }
                 } elseif ($message->getUserTeam() == "TERRORIST") {
                     if ($this->getStatus() == self::STATUS_WU_2_SIDE || $this->getStatus() == self::STATUS_WU_OT_2_SIDE) {
                         $team = $this->side['team_a'] == "t" ? $this->teamBName : $this->teamAName;
                     } else {
                         $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                     }
                     if (!$this->ready['t']) {
                         $this->ready['t'] = true;
                         $this->say($team . " (T) is now ready");
                     } else {
                         $this->say($team . " (T) is already ready");
                     }
                 }
                 $this->startMatch();
             }
         }
     } elseif ($text == "!pause" || $text == ".pause") {
         if ($this->isMatchRound() && !$this->isPaused && $this->enable) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say pause");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->pause['ct']) {
                     $this->pause['ct'] = true;
                     if (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantConfirm") {
                         $this->say($team . " (CT) want to pause, write !pause to confirm");
                     } elseif (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantNoConfirm") {
                         $this->say($team . " (CT)  will be paused now!");
                     } else {
                         $this->say($team . " (CT) want to pause, match will be paused next freezetime.");
                     }
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->pause['t']) {
                     $this->pause['t'] = true;
                     if (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantConfirm") {
                         $this->say($team . " (T) want to pause, write !pause to confirm");
                     } elseif (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantNoConfirm") {
                         $this->say($team . " (T)  will be paused now!");
                     } else {
                         $this->say($team . " (T) want to pause, match will be paused next freezetime.");
                     }
                 }
             }
             $this->pauseMatch();
         }
     } elseif ($text == "!unpause" || $text == ".unpause") {
         if ($this->isMatchRound() && $this->isPaused && $this->enable) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say pause");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->unpause['ct']) {
                     $this->unpause['ct'] = true;
                     $this->say($team . " (CT) want to remove pause, write !unpause to confirm");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->unpause['t']) {
                     $this->unpause['t'] = true;
                     $this->say($team . " (T) want to remove pause, write !unpause to confirm");
                 }
             }
             $this->unpauseMatch();
         }
     } elseif ($this->getStatus() == self::STATUS_END_KNIFE && ($text == "!stay" || $text == ".stay")) {
         if ($message->getUserTeam() == $this->winKnife) {
             $this->addLog($message->getUserName() . " want to stay, going to warmup");
             $this->setStatus(self::STATUS_WU_1_SIDE, true);
             $this->currentMap->setStatus(Map::STATUS_WU_1_SIDE, true);
             $this->rcon->send("mp_do_warmup_period 1");
             $this->rcon->send("mp_warmuptime 30");
             $this->rcon->send("mp_warmup_pausetimer 1");
             $this->rcon->send("mp_warmup_start");
             $this->say("nothing change, going to warmup");
         }
     } elseif ($this->getStatus() == self::STATUS_END_KNIFE && ($text == "!switch" || $text == ".switch" || $text == "!swap" || $text == ".swap")) {
         if ($message->getUserTeam() == $this->winKnife) {
             $this->addLog($message->getUserName() . " want to stay, going to warmup");
             $this->setStatus(self::STATUS_WU_1_SIDE, true);
             $this->currentMap->setStatus(Map::STATUS_WU_1_SIDE, true);
             $this->swapSides();
             $this->rcon->send("mp_do_warmup_period 1");
             $this->rcon->send("mp_warmuptime 30");
             $this->rcon->send("mp_warmup_pausetimer 1");
             $this->rcon->send("mp_warmup_start");
             $this->say("Swapping teams");
             $this->rcon->send("mp_swapteams");
             TaskManager::getInstance()->addTask(new Task($this, self::TASK_SEND_TEAM_NAMES, microtime(true) + 10));
         }
     } elseif ($text == "!notready" || $text == ".notready" || $text == "!unready" || $text == ".unready") {
         if ($this->isWarmupRound() && $this->mapIsEngaged) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say notready");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if ($this->ready['ct']) {
                     $this->ready['ct'] = false;
                     $this->say($team . " (CT) is now not ready");
                 } else {
                     $this->say($team . " (CT) is already not ready");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if ($this->ready['t']) {
                     $this->ready['t'] = false;
                     $this->say($team . " (T) is now not ready");
                 } else {
                     $this->say($team . " (T) is already not ready");
                 }
             }
         }
     } elseif (($text == "abort" || $text == ".abort") && $this->delay_ready_inprogress) {
         if ($this->isWarmupRound() && $this->ready['ct'] && $this->ready['t'] && \eBot\Config\Config::getInstance()->getDelayReady()) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") say abort");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 $this->say($team . " (CT) aborted the ready countdown");
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 $this->say($team . " (T) aborted the ready countdown");
             }
             $this->abortReady();
         }
     } elseif ($text == "!status") {
         if ($this->pluginCsay) {
             $this->addLog($message->getUserName() . " ask status");
             if ($this->enable) {
                 $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: Current status: " . $this->getStatusText() . "\"");
             } else {
                 $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: Current status: " . $this->getStatusText() . " - Match paused\"");
             }
         }
     } elseif ($text == "!status") {
         if ($this->pluginCsay) {
             $this->addLog($message->getUserName() . " ask status");
             $this->rcon->send("csay_to_player " . $message->userId . " \"eBot: " . $this->teamAName . " " . $this->currentMap->getScore1() . " - " . $this->currentMap->getScore2() . " " . $this->teamBName . "\"");
         }
     } else {
         // Dispatching events
         $event = new \eBot\Events\Event\Say();
         $event->setMatch($this);
         $event->setUserId($message->getUserId());
         $event->setUserName($message->getUserName());
         $event->setUserTeam($message->getUserTeam());
         $event->setUserSteamid($message->getUserSteamid());
         $event->setType($message->getType());
         $event->setText($message->getText());
         \eBot\Events\EventDispatcher::getInstance()->dispatchEvent($event);
     }
     switch ($message->getType()) {
         case \eBot\Message\Type\Say::SAY:
             $this->addMatchLog($this->getColoredUserNameHTML($message->getUserName(), $message->getUserTeam()) . ": " . htmlentities($message->getText()));
             break;
         case \eBot\Message\Type\Say::SAY_TEAM:
             $this->addMatchLog($this->getColoredUserNameHTML($message->getUserName(), $message->getUserTeam()) . " (private): " . htmlentities($message->getText()), true);
             break;
     }
 }
Ejemplo n.º 3
0
 /**
  * Processing say message
  * Made action with the message
  * Dispatch a Say event
  * @param \eBot\Message\Type\Say $message
  */
 private function processSay(\eBot\Message\Type\Say $message)
 {
     Logger::debug("Processing Say Message");
     $user = $this->processPlayer($message->getUserId(), $message->getUserName(), $message->getUserTeam(), $message->getUserSteamid());
     $text = trim($message->getText());
     if (preg_match('/\\!map (?<mapname>.*)/i', $text, $preg)) {
         if (!$this->mapIsEngaged && ($this->getStatus() == self::STATUS_WU_KNIFE && $this->config_kniferound || $this->getStatus() == self::STATUS_WU_1_SIDE && !$this->config_kniferound)) {
             $this->addLog($message->getUserName() . " (" . $message->getUserTeam() . ") wants to play '" . $preg['mapname'] . "'.");
             Logger::log($message->getUserName() . " (" . $message->getUserTeam() . ") wants to play '" . $preg['mapname'] . "'.");
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 $maps = \eBot\Config\Config::getInstance()->getMaps();
                 if (in_array($preg['mapname'], $maps)) {
                     $this->playMap['ct'] = $preg['mapname'];
                     $this->say($team . " (CT) wants to play '" . $this->formatText($preg['mapname'], "green") . "'.");
                 } else {
                     $this->say("Map: '" . $preg['mapname'] . "' was not found! Available maps are:");
                     foreach ($maps as $map) {
                         $mapmessage .= "{$map}, ";
                     }
                     $this->say(substr($mapmessage, 0, -2));
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 $maps = \eBot\Config\Config::getInstance()->getMaps();
                 if (in_array($preg['mapname'], $maps)) {
                     $this->playMap['t'] = $preg['mapname'];
                     $this->say($team . " (T) wants to play '" . $this->formatText($preg['mapname'], "green") . "'.");
                 } else {
                     $this->say($preg['mapname'] . " was not found! Available maps are:");
                     foreach ($maps as $map) {
                         $mapmessage .= "{$map}, ";
                     }
                     $this->say(substr($mapmessage, 0, -2));
                 }
             }
             $this->setMatchMap($preg['mapname']);
         } else {
             $this->addLog("Veto isn't enabled.");
         }
     } elseif ($this->isCommand($message, "stats")) {
         if ($user) {
             $this->say_player($message->userId, "Stats for " . $message->userName . ":");
             if ($user->get("death") == 0) {
                 $ratio = $user->get("kill");
             } else {
                 $ratio = round($user->get("kill") / $user->get("death"), 2);
             }
             if ($user->get("kill") == 0) {
                 $ratiohs = 0;
             } else {
                 $ratiohs = round($user->get("hs") / $user->get("kill") * 100, 2);
             }
             $this->say_player($message->userId, $this->formatText("Kill: ", "ltGreen") . $this->formatText($user->get("kill"), "green") . " - " . $this->formatText("HS: ", "ltGreen") . $this->formatText($user->get("hs"), "green"));
             $this->say_player($message->userId, $this->formatText("Death: ", "ltGreen") . $this->formatText($user->get("death"), "green") . " - " . $this->formatText("Score: ", "ltGreen") . $this->formatText($user->get("point"), "green"));
             $this->say_player($message->userId, $this->formatText("Ratio K/D: ", "ltGreen") . $this->formatText($ratio, "green") . " - " . $this->formatText("HS%: ", "ltGreen") . $this->formatText($ratiohs, "green"));
         } else {
             $this->say_player($message->userId, "No stats yet for " . $message->userName);
         }
     } elseif ($this->isCommand($message, "morestats")) {
         if ($user) {
             $this->say_player($message->userId, "Stats for " . $message->userName . ":");
             $stats = array();
             for ($i = 1; $i <= 5; $i++) {
                 if ($user->get("v{$i}") > 0) {
                     $stats[] = array("name" => "1v{$i}", "val" => $user->get("v{$i}"));
                 }
                 if ($user->get("k{$i}") > 0) {
                     $stats[] = array("name" => $i . " kill/round", "val" => $user->get("k{$i}"));
                 }
             }
             if ($user->get("bombe") > 0) {
                 $stats[] = array("name" => "Bomb", "val" => $user->get("bombe"));
             }
             if ($user->get("defuse") > 0) {
                 $stats[] = array("name" => "Defuse", "val" => $user->get("defuse"));
             }
             if ($user->get("tk") > 0) {
                 $stats[] = array("name" => "TK", "val" => $user->get("tk"));
             }
             if ($user->get("firstKill") > 0) {
                 $stats[] = array("name" => "First Kill", "val" => $user->get("firstKill"));
             }
             $messageText = "";
             $count = 0;
             $doit = true;
             foreach ($stats as $v) {
                 $count++;
                 $doit = false;
                 if ($messageText == "") {
                     $messageText = $this->formatText($v["name"], "ltGreen") . ": " . $this->formatText($v["val"], "green");
                 } else {
                     $messageText .= " - " . $this->formatText($v["name"], "ltGreen") . ": " . $this->formatText($v["val"], "green");
                 }
                 if ($count == 2) {
                     $this->say_player($message->userId, "{$messageText}");
                     $messageText = "";
                     $count = 0;
                 }
             }
             if ($count > 0) {
                 $this->say_player($message->userId, "{$messageText}");
             }
             if ($doit) {
                 $this->say_player($message->userId, "No stats yet.");
             }
         } else {
             $this->say_player($message->userId, "No stats yet for " . $this->formatText($message->userName, "ltGreen") . ".");
         }
     } elseif ($this->isCommand($message, "rules")) {
         if ($this->pluginCsay) {
             $this->say_player($message->userId, "Full Score: " . $this->formatText($this->config_full_score ? "yes" : "no", "ltGreen") . " :: Switch Auto: " . $this->formatText($this->config_switch_auto ? "yes" : "no", "ltGreen"));
             $this->say_player($message->userId, "Over Time: " . $this->formatText($this->config_ot ? "yes" : "no", "ltGreen") . " :: MaxRound: " . $this->formatText($this->maxRound, "ltGreen"));
         }
     } elseif ($this->isCommand($message, "help")) {
         if ($this->pluginCsay) {
             $this->say_player($message->userId, "commands available: !help, !status, !stats, !morestats, !score, !ready, !notready, !stop, !restart (for knife round), !stay, !switch");
         }
     } elseif ($this->isCommand($message, "restart")) {
         if ($this->getStatus() == self::STATUS_KNIFE || $this->getStatus() == self::STATUS_END_KNIFE) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->restart['ct']) {
                     $this->restart['ct'] = true;
                     $this->say($team . " (CT) wants to restart the knife round.");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->restart['t']) {
                     $this->restart['t'] = true;
                     $this->say($team . " (T) wants to restart the knife round.");
                 }
             }
             if ($this->restart["ct"] && $this->restart["t"]) {
                 $this->ready["ct"] = true;
                 $this->ready["t"] = true;
                 $this->setStatus(self::STATUS_WU_KNIFE);
                 $this->currentMap->setStatus(Map::STATUS_WU_KNIFE);
                 $this->restart["ct"] = false;
                 $this->restart["ct"] = false;
                 $this->addMatchLog("Restarting knife round.");
                 $this->addLog("Restarting knife round.");
                 $this->startMatch(true);
             }
         }
     } elseif (!\eBot\Config\Config::getInstance()->getConfigStopDisabled() && $this->isMatchRound() && $this->isCommand($message, "stop")) {
         if ($this->enable) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->stop['ct']) {
                     $this->stop['ct'] = true;
                     $this->say($team . " (CT) wants to stop.");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->stop['t']) {
                     $this->stop['t'] = true;
                     $this->say($team . " (T) wants to stop.");
                 }
             }
             $this->stopMatch();
         } else {
             $this->addLog("Can't stop match, it's already stopped.");
         }
     } elseif ($this->isMatchRound() && $this->isCommand($message, "continue")) {
         if (!$this->enable) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->continue['ct']) {
                     $this->continue['ct'] = true;
                     $this->say($team . " (CT) wants to go live.");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->continue['t']) {
                     $this->continue['t'] = true;
                     $this->say($team . " (T) wants to go live.");
                 }
             }
             $this->continueMatch();
         }
     } elseif ($this->isWarmupRound() && $this->mapIsEngaged && $this->isCommand($message, "ready")) {
         if ($this->config_streamer && !$this->getStreamerReady()) {
             $this->say("Streamers are not ready yet.", "red");
             $this->say("Please wait until they are ready.");
         } else {
             if ($message->getUserTeam() == "CT") {
                 if ($this->getStatus() == self::STATUS_WU_2_SIDE || $this->getStatus() == self::STATUS_WU_OT_2_SIDE) {
                     $team = $this->side['team_a'] == "ct" ? $this->teamBName : $this->teamAName;
                 } else {
                     $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 }
                 if (!$this->ready['ct']) {
                     $this->ready['ct'] = true;
                     $this->say($team . " (CT) is now " . $this->formatText("ready.", "green"));
                 } else {
                     $this->say($team . " (CT) is already " . $this->formatText("ready.", "green"));
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 if ($this->getStatus() == self::STATUS_WU_2_SIDE || $this->getStatus() == self::STATUS_WU_OT_2_SIDE) {
                     $team = $this->side['team_a'] == "t" ? $this->teamBName : $this->teamAName;
                 } else {
                     $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 }
                 if (!$this->ready['t']) {
                     $this->ready['t'] = true;
                     $this->say($team . " (T) is now " . $this->formatText("ready.", "green"));
                 } else {
                     $this->say($team . " (T) is already " . $this->formatText("ready.", "green"));
                 }
             }
             $this->startMatch();
         }
     } elseif ($this->isCommand($message, "pause")) {
         if ($this->isMatchRound() && !$this->isPaused && $this->enable) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->pause['ct']) {
                     $this->pause['ct'] = true;
                     if (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantConfirm") {
                         $this->say($team . " (CT) wants to pause, write !pause to confirm.");
                     } elseif (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantNoConfirm") {
                         $this->say($team . " (CT) match will be paused now!");
                     } else {
                         $this->say($team . " (CT) wants to pause, the match will be paused in the next freezetime.");
                     }
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->pause['t']) {
                     $this->pause['t'] = true;
                     if (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantConfirm") {
                         $this->say($team . " (T) wants to pause, write !pause to confirm.");
                     } elseif (\eBot\Config\Config::getInstance()->getPauseMethod() == "instantNoConfirm") {
                         $this->say($team . " (T) match will be paused now!");
                     } else {
                         $this->say($team . " (T) wants to pause, the match will be paused in the next freezetime.");
                     }
                 }
             }
             $this->pauseMatch();
         }
     } elseif ($this->isCommand($message, "unpause")) {
         if ($this->isMatchRound() && $this->isPaused && $this->enable) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 if (!$this->unpause['ct']) {
                     $this->unpause['ct'] = true;
                     $this->say($team . " (CT) wants to remove pause, write !unpause to confirm.");
                 }
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 if (!$this->unpause['t']) {
                     $this->unpause['t'] = true;
                     $this->say($team . " (T) wants to remove pause, write !unpause to confirm.");
                 }
             }
             $this->unpauseMatch();
         }
     } elseif ($this->getStatus() == self::STATUS_END_KNIFE && $message->getUserTeam() == $this->winKnife && $this->isCommand($message, "stay")) {
         $this->setStatus(self::STATUS_WU_1_SIDE, true);
         $this->currentMap->setStatus(Map::STATUS_WU_1_SIDE, true);
         $this->undoKnifeConfig()->executeMatchConfig()->executeWarmupConfig();
         $this->say("Nothing changed, going to warmup!");
     } elseif ($this->getStatus() == self::STATUS_END_KNIFE && $message->getUserTeam() == $this->winKnife && ($this->isCommand($message, "switch") || $this->isCommand($message, "swap"))) {
         $this->setStatus(self::STATUS_WU_1_SIDE, true);
         $this->currentMap->setStatus(Map::STATUS_WU_1_SIDE, true);
         $this->swapSides();
         $this->undoKnifeConfig()->executeMatchConfig()->executeWarmupConfig();
         $this->say("Swapping teams.");
         $this->rcon->send("mp_swapteams");
         TaskManager::getInstance()->addTask(new Task($this, self::TASK_SEND_TEAM_NAMES, microtime(true) + 10));
     } elseif ($this->isWarmupRound() && $this->mapIsEngaged && $this->isCommand($message, "notready") || $this->isCommand($message, "unready")) {
         if ($message->getUserTeam() == "CT") {
             $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
             if ($this->ready['ct']) {
                 $this->ready['ct'] = false;
                 $this->say($team . " (CT) is now " . $this->formatText("not ready.", "green"));
             } else {
                 $this->say($team . " (CT) is already " . $this->formatText("not ready.", "green"));
             }
         } elseif ($message->getUserTeam() == "TERRORIST") {
             $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
             if ($this->ready['t']) {
                 $this->ready['t'] = false;
                 $this->say($team . " (T) is now " . $this->formatText("not ready.", "green"));
             } else {
                 $this->say($team . " (T) is already " . $this->formatText("not ready.", "green"));
             }
         }
     } elseif ($this->isWarmupRound() && $this->delay_ready_inprogress && $this->isCommand($message, "abort")) {
         if ($this->ready['ct'] && $this->ready['t'] && \eBot\Config\Config::getInstance()->getDelayReady()) {
             if ($message->getUserTeam() == "CT") {
                 $team = $this->side['team_a'] == "ct" ? $this->teamAName : $this->teamBName;
                 $this->say($team . " (CT) " . $this->formatText("aborted", "green") . "the ready countdown.");
             } elseif ($message->getUserTeam() == "TERRORIST") {
                 $team = $this->side['team_a'] == "t" ? $this->teamAName : $this->teamBName;
                 $this->say($team . " (T) " . $this->formatText("aborted", "green") . "the ready countdown.");
             }
             $this->abortReady();
         }
     } elseif ($this->isCommand($message, "status")) {
         if ($this->pluginCsay) {
             if ($this->enable) {
                 $this->say_player($message->userId, "Current status: " . $this->formatText($this->getStatusText(), "red") . ".");
             } else {
                 $this->say_player($message->userId, "Current status: " . $this->formatText($this->getStatusText(), "red") . " - Match paused.");
             }
         }
     } elseif ($this->isCommand($message, "status2")) {
         // DUPLICATE - REMOVE? TODO
         if ($this->pluginCsay) {
             $this->say_player($message->userId, $this->formatText($this->teamAName, "ltGreen") . " " . $this->formatText($this->currentMap->getScore1(), "green") . " - " . $this->formatText($this->currentMap->getScore2(), "green") . " " . $this->formatText($this->teamBName, "ltGreen"));
         }
     } elseif ($this->isCommand($message, "version")) {
         // NYI - TODO
     } elseif ($this->isCommand($message, "debug")) {
         // NOT FINISHED - TODO
         $this->say("Status = '" . $this->getStatus() . "' (" . $this->getStatusText() . ").");
     } elseif ($this->isCommand($message, "fixwarmup")) {
         if (($this->getStatus() == self::STATUS_WU_1_SIDE || $this->getStatus() == self::STATUS_WU_KNIFE) && !$this->warmupManualFixIssued) {
             $this->say("Executing warmup config again.");
             $this->executeWarmupConfig();
             $this->warmupManualFixIssued = true;
         }
     } elseif ($this->isCommand($message, "connect")) {
         $this->say("CONNECT " . $this->server_ip . "; PASSWORD " . $this->matchData["config_password"] . ";");
     } else {
         // Dispatching events
         $event = new \eBot\Events\Event\Say();
         $event->setMatch($this);
         $event->setUserId($message->getUserId());
         $event->setUserName($message->getUserName());
         $event->setUserTeam($message->getUserTeam());
         $event->setUserSteamid($message->getUserSteamid());
         $event->setType($message->getType());
         $event->setText($message->getText());
         \eBot\Events\EventDispatcher::getInstance()->dispatchEvent($event);
     }
     switch ($message->getType()) {
         case \eBot\Message\Type\Say::SAY:
             $this->addMatchLog($this->getColoredUserNameHTML($message->getUserName(), $message->getUserTeam()) . ": " . htmlentities($message->getText()));
             break;
         case \eBot\Message\Type\Say::SAY_TEAM:
             $this->addMatchLog($this->getColoredUserNameHTML($message->getUserName(), $message->getUserTeam()) . " (private): " . htmlentities($message->getText()), true);
             break;
     }
 }