eliminate remaining empty() usages

This commit is contained in:
Dylan K. Taylor
2020-02-07 21:46:16 +00:00
parent 1ffabbb567
commit aac7da6c96
22 changed files with 40 additions and 30 deletions

View File

@@ -644,7 +644,7 @@ abstract class Entity{
$this->justCreated = false;
$changedProperties = $this->getSyncedNetworkData(true);
if(!empty($changedProperties)){
if(count($changedProperties) > 0){
$this->sendData($this->hasSpawned, $changedProperties);
$this->networkProperties->clearDirtyProperties();
}

View File

@@ -31,6 +31,7 @@ use pocketmine\world\sound\XpCollectSound;
use pocketmine\world\sound\XpLevelUpSound;
use function array_rand;
use function ceil;
use function count;
use function max;
use function min;
@@ -251,7 +252,7 @@ class ExperienceManager{
}
}
if(!empty($equipment)){
if(count($equipment) > 0){
$repairItem = $equipment[$k = array_rand($equipment)];
if($repairItem->getDamage() > 0){
$repairAmount = min($repairItem->getDamage(), $xpValue * 2);

View File

@@ -186,7 +186,7 @@ abstract class Living extends Entity{
$nbt->setShort("Air", $this->getAirSupplyTicks());
if(!empty($this->effectManager->all())){
if(count($this->effectManager->all()) > 0){
$effects = [];
foreach($this->effectManager->all() as $effect){
$effects[] = CompoundTag::create()

View File

@@ -29,6 +29,7 @@ use pocketmine\event\entity\EntityEffectRemoveEvent;
use pocketmine\utils\Color;
use pocketmine\utils\Utils;
use function abs;
use function count;
use function spl_object_id;
class EffectManager{
@@ -188,7 +189,7 @@ class EffectManager{
}
}
if(!empty($colors)){
if(count($colors) > 0){
$this->bubbleColor = Color::mix(...$colors);
$this->onlyAmbientEffects = $ambient;
}else{
@@ -217,7 +218,7 @@ class EffectManager{
}
}
return !empty($this->effects);
return count($this->effects) > 0;
}
/**