isFakePlayer

This commit is contained in:
kremsy 2013-12-29 12:13:45 +01:00
parent 390eb7b087
commit a2c423e7e8
2 changed files with 7 additions and 10 deletions

View File

@ -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 == "");
}

View File

@ -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);