mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 12:04:46 +00:00
eliminate remaining empty() usages
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user