From a2c423e7e86b108b58e2cd149fc03539e4a73b0d Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 29 Dec 2013 12:13:45 +0100 Subject: [PATCH] isFakePlayer --- application/core/Players/Player.php | 9 +++------ application/core/Players/PlayerManager.php | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/application/core/Players/Player.php b/application/core/Players/Player.php index fb657b74..a028295c 100644 --- a/application/core/Players/Player.php +++ b/application/core/Players/Player.php @@ -59,20 +59,17 @@ class Player { $this->ipAddress = $rpcInfos['IPAddress']; $this->joinTime = time(); + } - - - /** * Check if player is not a real player * * @return bool */ - // TODO: check for bot players - public function isFakePlayer() { //TODO Bot have also positive pids, so this is useless, just stringmatch *fake - return ($this->pid <= 0); + public function isFakePlayer() { + return ($this->pid <= 0 || $this->path == ""); } diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index f708bf4a..04689e89 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -129,8 +129,8 @@ class PlayerManager implements CallbackListener { $player = new Player($playerInfo); $this->addPlayer($player); - - if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) { + + if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES) && !$player->isFakePlayer()) { $string = array(0 => '$0f0Player', 1 => '$0f0Moderator', 2 => '$0f0Admin', 3 => '$0f0MasterAdmin', 4 => '$0f0MasterAdmin'); //$nickname = Formatter::stripCodes($player->nickname); // TODO: strip codes without colour codes like in serverviewer @@ -156,8 +156,8 @@ class PlayerManager implements CallbackListener { $login = $callback[1][0]; $player = $this->removePlayer($login); - //if($player->isFakePlayer()) - //return; + if($player->isFakePlayer()) + return; $played = Formatter::formatTimeH(time() - $player->joinTime); $this->maniaControl->log("Player left: " . $player->login . " / " . Formatter::stripCodes($player->nickname) . " Playtime: " . $played);