removed weird != null comparing
(why are you doing this??)
This commit is contained in:
parent
43badf4baa
commit
2c066f7b62
@ -119,7 +119,7 @@ class DatabaseConverter { //TODO move bind param before loop everywhere, convert
|
||||
*/
|
||||
public function __destruct() {
|
||||
$this->mysqli->close();
|
||||
if ($this->sourceMysqli != null) {
|
||||
if ($this->sourceMysqli) {
|
||||
$this->sourceMysqli->close();
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
||||
foreach($this->adminListShown as $login => $shown) {
|
||||
if ($shown) {
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->showAdminLists($player);
|
||||
} else {
|
||||
unset($this->adminListShown[$login]);
|
||||
|
@ -248,9 +248,9 @@ class ManiaExchangeManager{
|
||||
|
||||
$maps = array();
|
||||
foreach($mxMapList as $map) {
|
||||
if ($map != null) {
|
||||
if ($map) {
|
||||
$mxMapObject = new MXMapInfo($titlePrefix, $map);
|
||||
if ($mxMapObject != null) {
|
||||
if ($mxMapObject) {
|
||||
array_push($maps, $mxMapObject);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class Map {
|
||||
*/
|
||||
public function updateAvailable() {
|
||||
|
||||
if ($this->mx != null && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) {
|
||||
if ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -98,7 +98,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
*/
|
||||
public function command_ShowNextMap(array $chat, Player $player) {
|
||||
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
||||
if ($nextQueued != null) {
|
||||
if ($nextQueued) {
|
||||
/** @var Player $requester */
|
||||
$requester = $nextQueued[0];
|
||||
/** @var Map $map */
|
||||
|
@ -566,7 +566,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
foreach($this->mapListShown as $login => $shown) {
|
||||
if ($shown) {
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->showMapList($player);
|
||||
} else {
|
||||
unset($this->mapListShown[$login]);
|
||||
|
@ -325,7 +325,7 @@ class MapManager implements CallbackListener {
|
||||
|
||||
$this->fetchCurrentMap();
|
||||
|
||||
if ($admin != null) {
|
||||
if ($admin) {
|
||||
$message = '$<' . $admin->nickname . '$> shuffled the Maplist!';
|
||||
$this->maniaControl->chat->sendSuccess($message);
|
||||
$this->maniaControl->log($message, true);
|
||||
@ -619,7 +619,7 @@ class MapManager implements CallbackListener {
|
||||
*/
|
||||
private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) {
|
||||
// Check if map is already on the server
|
||||
if ($this->getMapByUid($mapInfo->uid) != null) {
|
||||
if ($this->getMapByUid($mapInfo->uid)) {
|
||||
// Download error
|
||||
$this->maniaControl->chat->sendError('Map is already on the server!', $login);
|
||||
return;
|
||||
|
@ -151,7 +151,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
$player = $queuedMap[0];
|
||||
|
||||
//found player, so play this map
|
||||
if ($this->maniaControl->playerManager->getPlayer($player->login) != null) {
|
||||
if ($this->maniaControl->playerManager->getPlayer($player->login)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
$this->playersListShown[$login] = false;
|
||||
}
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->showPlayerList($player);
|
||||
} else {
|
||||
// if player with the open widget disconnected remove him from the shownlist
|
||||
|
@ -267,7 +267,7 @@ class StatisticCollector implements CallbackListener {
|
||||
$victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]);
|
||||
if (isset($callback[1][1][0])) {
|
||||
$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]);
|
||||
if ($shooter != null) {
|
||||
if ($shooter) {
|
||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ class StatisticCollector implements CallbackListener {
|
||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim);
|
||||
if (isset($paramsObject->Event->Shooter->Login)) {
|
||||
$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login);
|
||||
if ($shooter != null) {
|
||||
if ($shooter) {
|
||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||
}
|
||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter);
|
||||
|
@ -396,15 +396,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
*/
|
||||
private function performCoreUpdate(UpdateData $updateData, Player $player = null) {
|
||||
if (!$this->checkPermissions()) {
|
||||
if ($player != null) {
|
||||
$this->maniaControl->chat->sendError('Update failed: Incorrect Filesystem permissions!', $player->login);
|
||||
if ($player) {
|
||||
$this->maniaControl->chat->sendError('Update failed: Incorrect file system permissions!', $player->login);
|
||||
}
|
||||
$this->maniaControl->log('Update failed!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($updateData->url) && !isset($updateData->releaseDate)) {
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->maniaControl->chat->sendError('Update failed: No update Data available!', $player->login);
|
||||
}
|
||||
$this->maniaControl->log('Update failed: No update Data available!');
|
||||
@ -421,7 +421,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
$bytes = file_put_contents($updateFileName, $updateFileContent);
|
||||
if (!$bytes || $bytes <= 0) {
|
||||
trigger_error("Couldn't save Update Zip.");
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->maniaControl->chat->sendError('Update failed: Couldn\'t save Update zip!', $player->login);
|
||||
}
|
||||
return false;
|
||||
@ -430,7 +430,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
$result = $zip->open($updateFileName);
|
||||
if ($result !== true) {
|
||||
trigger_error("Couldn't open Update Zip. ({$result})");
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->maniaControl->chat->sendError('Update failed: Couldn\'t open Update zip!', $player->login);
|
||||
}
|
||||
return false;
|
||||
@ -444,7 +444,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
//Set the Nightly Build Date
|
||||
$this->setNightlyBuildDate($updateData->releaseDate);
|
||||
|
||||
if ($player != null) {
|
||||
if ($player) {
|
||||
$this->maniaControl->chat->sendSuccess('Update finished!', $player->login);
|
||||
}
|
||||
$this->maniaControl->log("Update finished!");
|
||||
|
@ -315,7 +315,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$type = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MIN_RANKING_TYPE);
|
||||
|
||||
$message = '';
|
||||
if ($rankObj != null) {
|
||||
if ($rankObj) {
|
||||
switch($type) {
|
||||
case self::RANKING_TYPE_RATIOS:
|
||||
$kd = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index);
|
||||
@ -426,7 +426,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
public function showNextRank(Player $player) {
|
||||
$rankObject = $this->getRank($player);
|
||||
|
||||
if ($rankObject != null) {
|
||||
if ($rankObject) {
|
||||
if ($rankObject->rank > 1) {
|
||||
$nextRank = $this->getNextRank($player);
|
||||
$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex);
|
||||
|
@ -492,7 +492,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$label->setText($author);
|
||||
$label->setTextColor("FFF");
|
||||
|
||||
if ($requester != null) {
|
||||
if ($requester) {
|
||||
$label = new Label_Text();
|
||||
$frame->add($label);
|
||||
$label->setX(0);
|
||||
|
Loading…
Reference in New Issue
Block a user