removed weird == null comparing

This commit is contained in:
Steffen Schröder 2014-03-31 21:54:51 +02:00
parent d6cbba3d4b
commit fd0d84dfb0
7 changed files with 10 additions and 20 deletions

View File

@ -99,7 +99,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
}
$function = function ($maps) use (&$player) {
if ($maps == null) {
if (!$maps) {
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
return;
}

View File

@ -175,7 +175,7 @@ class MapQueue implements CallbackListener, CommandListener {
$this->nextMap = array_shift($this->queuedMaps);
//Check if Map Queue is empty
if ($this->nextMap == null || !isset($this->nextMap[1])) {
if (!$this->nextMap || !isset($this->nextMap[1])) {
return;
}
$map = $this->nextMap[1];

View File

@ -109,7 +109,7 @@ class Player {
$this->joinTime = time();
if ($this->nickname == null || $this->nickname == '') {
if (!$this->nickname) {
$this->nickname = $this->login;
}
}

View File

@ -165,16 +165,12 @@ class PlayerManager implements CallbackListener, TimerListener {
public function playerDisconnect(array $callback) {
$login = $callback[1][0];
$player = $this->removePlayer($login);
if ($player == null) {
return;
}
if (!$player) return;
// Trigger own callback
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player);
if ($player->isFakePlayer()) {
return;
}
if ($player->isFakePlayer()) return;
$played = Formatter::formatTimeH(time() - $player->joinTime);
$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}";
@ -192,9 +188,7 @@ class PlayerManager implements CallbackListener, TimerListener {
*/
public function playerInfoChanged(array $callback) {
$player = $this->getPlayer($callback[1][0]['Login']);
if ($player == null) {
return;
}
if (!$player) return;
$player->ladderRank = $callback[1][0]["LadderRanking"];
$player->teamId = $callback[1][0]["TeamId"];

View File

@ -114,9 +114,7 @@ class StatisticManager {
$mysqli = $this->maniaControl->database->mysqli;
$statId = $this->getStatId($statName);
if ($statId == null) {
return -1;
}
if (!$statId) return -1;
if ($serverIndex == -1) {
$query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";";

View File

@ -15,9 +15,7 @@ class DedimaniaPlayer {
public $options = '';
public function __construct($player) {
if ($player == null) {
return;
}
if (!$player) return;
$this->login = $player['Login'];
$this->maxRank = $player['MaxRank'];

View File

@ -27,7 +27,7 @@ class RecordData {
* @param $record
*/
public function __construct($record) {
if ($record == null) {
if (!$record) {
$this->nullRecord = true;
return;
}