From b7b7bcee4f0a453faf57d5550265e866265de0c2 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 5 Jun 2017 21:07:24 +0100 Subject: [PATCH] Fixed some weak comparisons --- src/pocketmine/Server.php | 4 ++-- src/pocketmine/block/Cactus.php | 2 +- src/pocketmine/block/Crops.php | 2 +- src/pocketmine/block/MelonStem.php | 2 +- src/pocketmine/block/PumpkinStem.php | 2 +- src/pocketmine/entity/Entity.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 617a24b9e..7a83f099e 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2043,7 +2043,7 @@ class Server{ } - if($this->getProperty("network.upnp-forwarding", false) == true){ + if($this->getProperty("network.upnp-forwarding", false)){ $this->logger->info("[UPnP] Trying to port forward..."); UPnP::PortForward($this->getPort()); } @@ -2140,7 +2140,7 @@ class Server{ if($p instanceof Plugin and !($p->getPluginLoader() instanceof PharPluginLoader)){ $report = false; } - }elseif(\Phar::running(true) == ""){ + }elseif(\Phar::running(true) === ""){ $report = false; } if($dump->getData()["error"]["type"] === "E_PARSE" or $dump->getData()["error"]["type"] === "E_COMPILE_ERROR"){ diff --git a/src/pocketmine/block/Cactus.php b/src/pocketmine/block/Cactus.php index 4e80e766b..72a3a8435 100644 --- a/src/pocketmine/block/Cactus.php +++ b/src/pocketmine/block/Cactus.php @@ -84,7 +84,7 @@ class Cactus extends Transparent{ } }elseif($type === Level::BLOCK_UPDATE_RANDOM){ if($this->getSide(0)->getId() !== self::CACTUS){ - if($this->meta == 0x0F){ + if($this->meta === 0x0f){ for($y = 1; $y < 3; ++$y){ $b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); if($b->getId() === self::AIR){ diff --git a/src/pocketmine/block/Crops.php b/src/pocketmine/block/Crops.php index 963b107d4..16b7bdb86 100644 --- a/src/pocketmine/block/Crops.php +++ b/src/pocketmine/block/Crops.php @@ -74,7 +74,7 @@ abstract class Crops extends Flowable{ return Level::BLOCK_UPDATE_NORMAL; } }elseif($type === Level::BLOCK_UPDATE_RANDOM){ - if(mt_rand(0, 2) == 1){ + if(mt_rand(0, 2) === 1){ if($this->meta < 0x07){ $block = clone $this; ++$block->meta; diff --git a/src/pocketmine/block/MelonStem.php b/src/pocketmine/block/MelonStem.php index 6f2a32cfe..d9d86e217 100644 --- a/src/pocketmine/block/MelonStem.php +++ b/src/pocketmine/block/MelonStem.php @@ -46,7 +46,7 @@ class MelonStem extends Crops{ return Level::BLOCK_UPDATE_NORMAL; } }elseif($type === Level::BLOCK_UPDATE_RANDOM){ - if(mt_rand(0, 2) == 1){ + if(mt_rand(0, 2) === 1){ if($this->meta < 0x07){ $block = clone $this; ++$block->meta; diff --git a/src/pocketmine/block/PumpkinStem.php b/src/pocketmine/block/PumpkinStem.php index e8a653bac..d88c00e21 100644 --- a/src/pocketmine/block/PumpkinStem.php +++ b/src/pocketmine/block/PumpkinStem.php @@ -46,7 +46,7 @@ class PumpkinStem extends Crops{ return Level::BLOCK_UPDATE_NORMAL; } }elseif($type === Level::BLOCK_UPDATE_RANDOM){ - if(mt_rand(0, 2) == 1){ + if(mt_rand(0, 2) === 1){ if($this->meta < 0x07){ $block = clone $this; ++$block->meta; diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 00ad83a02..93522088d 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -763,8 +763,8 @@ abstract class Entity extends Location implements Metadatable{ $this->namedtag->FallDistance = new FloatTag("FallDistance", $this->fallDistance); $this->namedtag->Fire = new ShortTag("Fire", $this->fireTicks); $this->namedtag->Air = new ShortTag("Air", $this->getDataProperty(self::DATA_AIR)); - $this->namedtag->OnGround = new ByteTag("OnGround", $this->onGround == true ? 1 : 0); - $this->namedtag->Invulnerable = new ByteTag("Invulnerable", $this->invulnerable == true ? 1 : 0); + $this->namedtag->OnGround = new ByteTag("OnGround", $this->onGround ? 1 : 0); + $this->namedtag->Invulnerable = new ByteTag("Invulnerable", $this->invulnerable ? 1 : 0); if(count($this->effects) > 0){ $effects = [];