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