mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Merge commit '8726604899d1a371567141e0831ed570d3233356'
This commit is contained in:
commit
0f718ea28b
@ -145,7 +145,7 @@ namespace pocketmine {
|
||||
}
|
||||
|
||||
function server(){
|
||||
if(!empty($messages = check_platform_dependencies())){
|
||||
if(count($messages = check_platform_dependencies()) > 0){
|
||||
echo PHP_EOL;
|
||||
$binary = version_compare(PHP_VERSION, "5.4") >= 0 ? PHP_BINARY : "unknown";
|
||||
critical_error("Selected PHP binary ($binary) does not satisfy some requirements.");
|
||||
|
@ -1425,7 +1425,7 @@ class Server{
|
||||
* @return bool
|
||||
*/
|
||||
public function broadcastPackets(array $players, array $packets) : bool{
|
||||
if(empty($packets)){
|
||||
if(count($packets) === 0){
|
||||
throw new \InvalidArgumentException("Cannot broadcast empty list of packets");
|
||||
}
|
||||
|
||||
@ -1436,7 +1436,7 @@ class Server{
|
||||
$recipients[] = $player->getNetworkSession();
|
||||
}
|
||||
}
|
||||
if(empty($recipients)){
|
||||
if(count($recipients) === 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,7 @@ class Block{
|
||||
*/
|
||||
public function calculateIntercept(Vector3 $pos1, Vector3 $pos2) : ?RayTraceResult{
|
||||
$bbs = $this->getCollisionBoxes();
|
||||
if(empty($bbs)){
|
||||
if(count($bbs) === 0){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -326,12 +326,12 @@ class SimpleCommandMap implements CommandMap{
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($recursive)){
|
||||
if(count($recursive) > 0){
|
||||
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.recursive", [$alias, implode(", ", $recursive)]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!empty($bad)){
|
||||
if(count($bad) > 0){
|
||||
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.notFound", [$alias, implode(", ", $bad)]));
|
||||
continue;
|
||||
}
|
||||
|
@ -99,6 +99,6 @@ class ShapelessRecipe implements CraftingRecipe{
|
||||
return false; //failed to match the needed item to a given item
|
||||
}
|
||||
|
||||
return empty($input); //crafting grid should be empty apart from the given ingredient stacks
|
||||
return count($input) === 0; //crafting grid should be empty apart from the given ingredient stacks
|
||||
}
|
||||
}
|
||||
|
@ -717,7 +717,7 @@ abstract class Living extends Entity{
|
||||
*/
|
||||
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{
|
||||
$line = $this->getLineOfSight($maxDistance, 1, $transparent);
|
||||
if(!empty($line)){
|
||||
if(count($line) > 0){
|
||||
return array_shift($line);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
|
||||
use pocketmine\utils\Color;
|
||||
use pocketmine\world\particle\PotionSplashParticle;
|
||||
use pocketmine\world\sound\PotionSplashSound;
|
||||
use function count;
|
||||
use function round;
|
||||
use function sqrt;
|
||||
|
||||
@ -75,7 +76,7 @@ class SplashPotion extends Throwable{
|
||||
$effects = $this->getPotionEffects();
|
||||
$hasEffects = true;
|
||||
|
||||
if(empty($effects)){
|
||||
if(count($effects) === 0){
|
||||
$particle = new PotionSplashParticle(PotionSplashParticle::DEFAULT_COLOR());
|
||||
$hasEffects = false;
|
||||
}else{
|
||||
|
@ -68,14 +68,14 @@ class CraftingTransaction extends InventoryTransaction{
|
||||
* @throws TransactionValidationException
|
||||
*/
|
||||
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{
|
||||
if(empty($recipeItems)){
|
||||
if(count($recipeItems) === 0){
|
||||
throw new TransactionValidationException("No recipe items given");
|
||||
}
|
||||
if(empty($txItems)){
|
||||
if(count($txItems) === 0){
|
||||
throw new TransactionValidationException("No transaction items given");
|
||||
}
|
||||
|
||||
while(!empty($recipeItems)){
|
||||
while(count($recipeItems) > 0){
|
||||
/** @var Item $recipeItem */
|
||||
$recipeItem = array_pop($recipeItems);
|
||||
$needCount = $recipeItem->getCount();
|
||||
@ -114,7 +114,7 @@ class CraftingTransaction extends InventoryTransaction{
|
||||
if($iterations < 1){
|
||||
throw new TransactionValidationException("Tried to craft zero times");
|
||||
}
|
||||
if(!empty($txItems)){
|
||||
if(count($txItems) > 0){
|
||||
//all items should be destroyed in this process
|
||||
throw new TransactionValidationException("Expected 0 ingredients left over, have " . count($txItems));
|
||||
}
|
||||
|
@ -238,13 +238,13 @@ class InventoryTransaction{
|
||||
* @return null|Item
|
||||
*/
|
||||
protected function findResultItem(Item $needOrigin, array $possibleActions) : ?Item{
|
||||
assert(!empty($possibleActions));
|
||||
assert(count($possibleActions) > 0);
|
||||
|
||||
foreach($possibleActions as $i => $action){
|
||||
if($action->getSourceItem()->equalsExact($needOrigin)){
|
||||
$newList = $possibleActions;
|
||||
unset($newList[$i]);
|
||||
if(empty($newList)){
|
||||
if(count($newList) === 0){
|
||||
return $action->getTargetItem();
|
||||
}
|
||||
$result = $this->findResultItem($action->getTargetItem(), $newList);
|
||||
|
@ -32,6 +32,7 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\sound\PaintingPlaceSound;
|
||||
use function array_rand;
|
||||
use function count;
|
||||
|
||||
class PaintingItem extends Item{
|
||||
|
||||
@ -64,7 +65,7 @@ class PaintingItem extends Item{
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($motives)){ //No space available
|
||||
if(count($motives) === 0){ //No space available
|
||||
return ItemUseResult::NONE();
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\permission;
|
||||
|
||||
use function array_shift;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function implode;
|
||||
use function strlen;
|
||||
@ -173,19 +174,19 @@ class BanEntry{
|
||||
|
||||
$parts = explode("|", trim($str));
|
||||
$entry = new BanEntry(trim(array_shift($parts)));
|
||||
if(!empty($parts)){
|
||||
if(count($parts) > 0){
|
||||
$entry->setCreated(self::parseDate(array_shift($parts)));
|
||||
}
|
||||
if(!empty($parts)){
|
||||
if(count($parts) > 0){
|
||||
$entry->setSource(trim(array_shift($parts)));
|
||||
}
|
||||
if(!empty($parts)){
|
||||
if(count($parts) > 0){
|
||||
$expire = trim(array_shift($parts));
|
||||
if($expire !== "" and strtolower($expire) !== "forever"){
|
||||
$entry->setExpires(self::parseDate($expire));
|
||||
}
|
||||
}
|
||||
if(!empty($parts)){
|
||||
if(count($parts) > 0){
|
||||
$entry->setReason(trim(array_shift($parts)));
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class PermissionManager{
|
||||
public function unsubscribeFromAllPermissions(Permissible $permissible) : void{
|
||||
foreach($this->permSubs as $permission => &$subs){
|
||||
unset($subs[spl_object_id($permissible)]);
|
||||
if(empty($subs)){
|
||||
if(count($subs) === 0){
|
||||
unset($this->permSubs[$permission]);
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ class Config{
|
||||
while(count($vars) > 0){
|
||||
$nodeName = array_shift($vars);
|
||||
if(isset($currentNode[$nodeName])){
|
||||
if(empty($vars)){ //final node
|
||||
if(count($vars) === 0){ //final node
|
||||
unset($currentNode[$nodeName]);
|
||||
}elseif(is_array($currentNode[$nodeName])){
|
||||
$currentNode =& $currentNode[$nodeName];
|
||||
|
@ -33,6 +33,7 @@ use function implode;
|
||||
use function ini_get;
|
||||
use function ini_set;
|
||||
use function is_link;
|
||||
use function is_string;
|
||||
use function json_decode;
|
||||
use function parse_ini_file;
|
||||
use function preg_match;
|
||||
@ -144,7 +145,7 @@ abstract class Timezone{
|
||||
// RHEL / CentOS
|
||||
if(file_exists('/etc/sysconfig/clock')){
|
||||
$data = parse_ini_file('/etc/sysconfig/clock');
|
||||
if(!empty($data['ZONE'])){
|
||||
if(isset($data['ZONE']) and is_string($data['ZONE'])){
|
||||
return trim($data['ZONE']);
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +447,7 @@ class World implements ChunkManager{
|
||||
if(!is_array($pk)){
|
||||
$pk = [$pk];
|
||||
}
|
||||
if(!empty($pk)){
|
||||
if(count($pk) > 0){
|
||||
if($players === null){
|
||||
foreach($pk as $e){
|
||||
$this->broadcastPacketToViewers($pos, $e);
|
||||
@ -463,7 +463,7 @@ class World implements ChunkManager{
|
||||
if(!is_array($pk)){
|
||||
$pk = [$pk];
|
||||
}
|
||||
if(!empty($pk)){
|
||||
if(count($pk) > 0){
|
||||
if($players === null){
|
||||
foreach($pk as $e){
|
||||
$this->broadcastPacketToViewers($pos, $e);
|
||||
@ -806,7 +806,7 @@ class World implements ChunkManager{
|
||||
if(count($this->changedBlocks) > 0){
|
||||
if(count($this->players) > 0){
|
||||
foreach($this->changedBlocks as $index => $blocks){
|
||||
if(empty($blocks)){ //blocks can be set normally and then later re-set with direct send
|
||||
if(count($blocks) === 0){ //blocks can be set normally and then later re-set with direct send
|
||||
continue;
|
||||
}
|
||||
World::getXZ($index, $chunkX, $chunkZ);
|
||||
@ -833,8 +833,8 @@ class World implements ChunkManager{
|
||||
$this->checkSleep();
|
||||
}
|
||||
|
||||
if(!empty($this->globalPackets)){
|
||||
if(!empty($this->players)){
|
||||
if(count($this->globalPackets) > 0){
|
||||
if(count($this->players) > 0){
|
||||
$this->server->broadcastPackets($this->players, $this->globalPackets);
|
||||
}
|
||||
$this->globalPackets = [];
|
||||
@ -1617,7 +1617,7 @@ class World implements ChunkManager{
|
||||
|
||||
$item->onDestroyBlock($target);
|
||||
|
||||
if(!empty($drops)){
|
||||
if(count($drops) > 0){
|
||||
$dropPos = $vector->add(0.5, 0.5, 0.5);
|
||||
foreach($drops as $drop){
|
||||
if(!$drop->isNull()){
|
||||
@ -1711,7 +1711,7 @@ class World implements ChunkManager{
|
||||
}
|
||||
|
||||
foreach($hand->getCollisionBoxes() as $collisionBox){
|
||||
if(!empty($this->getCollidingEntities($collisionBox))){
|
||||
if(count($this->getCollidingEntities($collisionBox)) > 0){
|
||||
return false; //Entity in block
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,11 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/plugin/PharPluginLoader.php
|
||||
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between int\\<1, max\\> and 0 will always evaluate to false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Config.php
|
||||
|
||||
-
|
||||
#ReflectionFunction::getClosureThis() should be nullable
|
||||
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
||||
|
Loading…
x
Reference in New Issue
Block a user