removed weird == null comparing
This commit is contained in:
parent
d6cbba3d4b
commit
fd0d84dfb0
@ -99,7 +99,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
$function = function ($maps) use (&$player) {
|
$function = function ($maps) use (&$player) {
|
||||||
if ($maps == null) {
|
if (!$maps) {
|
||||||
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
$this->nextMap = array_shift($this->queuedMaps);
|
$this->nextMap = array_shift($this->queuedMaps);
|
||||||
|
|
||||||
//Check if Map Queue is empty
|
//Check if Map Queue is empty
|
||||||
if ($this->nextMap == null || !isset($this->nextMap[1])) {
|
if (!$this->nextMap || !isset($this->nextMap[1])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$map = $this->nextMap[1];
|
$map = $this->nextMap[1];
|
||||||
|
@ -109,7 +109,7 @@ class Player {
|
|||||||
|
|
||||||
$this->joinTime = time();
|
$this->joinTime = time();
|
||||||
|
|
||||||
if ($this->nickname == null || $this->nickname == '') {
|
if (!$this->nickname) {
|
||||||
$this->nickname = $this->login;
|
$this->nickname = $this->login;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,16 +165,12 @@ class PlayerManager implements CallbackListener, TimerListener {
|
|||||||
public function playerDisconnect(array $callback) {
|
public function playerDisconnect(array $callback) {
|
||||||
$login = $callback[1][0];
|
$login = $callback[1][0];
|
||||||
$player = $this->removePlayer($login);
|
$player = $this->removePlayer($login);
|
||||||
|
if (!$player) return;
|
||||||
|
|
||||||
if ($player == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player);
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player);
|
||||||
|
|
||||||
if ($player->isFakePlayer()) {
|
if ($player->isFakePlayer()) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$played = Formatter::formatTimeH(time() - $player->joinTime);
|
$played = Formatter::formatTimeH(time() - $player->joinTime);
|
||||||
$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}";
|
$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}";
|
||||||
@ -192,9 +188,7 @@ class PlayerManager implements CallbackListener, TimerListener {
|
|||||||
*/
|
*/
|
||||||
public function playerInfoChanged(array $callback) {
|
public function playerInfoChanged(array $callback) {
|
||||||
$player = $this->getPlayer($callback[1][0]['Login']);
|
$player = $this->getPlayer($callback[1][0]['Login']);
|
||||||
if ($player == null) {
|
if (!$player) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$player->ladderRank = $callback[1][0]["LadderRanking"];
|
$player->ladderRank = $callback[1][0]["LadderRanking"];
|
||||||
$player->teamId = $callback[1][0]["TeamId"];
|
$player->teamId = $callback[1][0]["TeamId"];
|
||||||
|
@ -114,9 +114,7 @@ class StatisticManager {
|
|||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$statId = $this->getStatId($statName);
|
$statId = $this->getStatId($statName);
|
||||||
|
|
||||||
if ($statId == null) {
|
if (!$statId) return -1;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($serverIndex == -1) {
|
if ($serverIndex == -1) {
|
||||||
$query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";";
|
$query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";";
|
||||||
|
@ -15,9 +15,7 @@ class DedimaniaPlayer {
|
|||||||
public $options = '';
|
public $options = '';
|
||||||
|
|
||||||
public function __construct($player) {
|
public function __construct($player) {
|
||||||
if ($player == null) {
|
if (!$player) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->login = $player['Login'];
|
$this->login = $player['Login'];
|
||||||
$this->maxRank = $player['MaxRank'];
|
$this->maxRank = $player['MaxRank'];
|
||||||
|
@ -27,7 +27,7 @@ class RecordData {
|
|||||||
* @param $record
|
* @param $record
|
||||||
*/
|
*/
|
||||||
public function __construct($record) {
|
public function __construct($record) {
|
||||||
if ($record == null) {
|
if (!$record) {
|
||||||
$this->nullRecord = true;
|
$this->nullRecord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user