Merge branch 'next-minor'

This commit is contained in:
Dylan K. Taylor
2019-10-22 19:05:11 +01:00
11 changed files with 39 additions and 16 deletions

View File

@@ -45,7 +45,7 @@ class Chest extends Spawnable implements Container, Nameable{
/** @var ChestInventory */
protected $inventory;
/** @var DoubleChestInventory */
/** @var DoubleChestInventory|null */
protected $doubleInventory = null;
/** @var int|null */

View File

@@ -199,6 +199,9 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
return (int) min(100, 7 * $this->xpManager->getXpLevel());
}
/**
* @return PlayerInventory
*/
public function getInventory(){
return $this->inventory;
}

View File

@@ -23,9 +23,9 @@ declare(strict_types=1);
namespace pocketmine\entity;
use Ahc\Json\Comment as CommentedJsonDecoder;
use function implode;
use function in_array;
use function json_decode;
use function json_encode;
use function json_last_error_msg;
use function strlen;
@@ -61,7 +61,7 @@ final class Skin{
}
if($geometryData !== ""){
$decodedGeometry = json_decode($geometryData);
$decodedGeometry = (new CommentedJsonDecoder())->decode($geometryData);
if($decodedGeometry === false){
throw new \InvalidArgumentException("Invalid geometry data (" . json_last_error_msg() . ")");
}

View File

@@ -164,7 +164,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/**
* @param CommandEnum $enum
* @param string[] $enumValueMap
* @param int[] $enumValueMap
*/
protected function putEnum(CommandEnum $enum, array $enumValueMap) : void{
$this->putString($enum->getName());

View File

@@ -42,7 +42,7 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac
*/
public static function create(array $blobs) : self{
//type check
(static function(ChunkCacheBlob ...$blobs){})($blobs);
(static function(ChunkCacheBlob ...$blobs){})(...$blobs);
$result = new self;
$result->blobs = $blobs;

View File

@@ -57,7 +57,7 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
}
public static function withCache(int $chunkX, int $chunkZ, int $subChunkCount, array $usedBlobHashes, string $extraPayload) : self{
(static function(int ...$hashes){})($usedBlobHashes);
(static function(int ...$hashes){})(...$usedBlobHashes);
$result = new self;
$result->chunkX = $chunkX;
$result->chunkZ = $chunkZ;

View File

@@ -95,12 +95,7 @@ class PermissionParser{
$desc = null;
$children = [];
if(isset($data["default"])){
$value = PermissionParser::defaultFromString($data["default"]);
if($value !== null){
$default = $value;
}else{
throw new \InvalidStateException("'default' key contained unknown value");
}
$default = PermissionParser::defaultFromString($data["default"]);
}
if(isset($data["children"])){

View File

@@ -27,7 +27,7 @@ use pocketmine\utils\Utils;
abstract class Task{
/** @var TaskHandler */
/** @var TaskHandler|null */
private $taskHandler = null;
/**

View File

@@ -45,7 +45,7 @@ class MainLogger extends \AttachableThreadedLogger{
/** @var \Threaded */
protected $logStream;
/** @var bool */
protected $shutdown;
protected $shutdown = false;
/** @var bool */
protected $logDebug;
/** @var bool */
@@ -272,7 +272,6 @@ class MainLogger extends \AttachableThreadedLogger{
}
public function run() : void{
$this->shutdown = false;
$logResource = fopen($this->logFile, "ab");
if(!is_resource($logResource)){
throw new \RuntimeException("Couldn't open log file");

View File

@@ -36,7 +36,7 @@ abstract class LightUpdate{
/** @var ChunkManager */
protected $world;
/** @var int[] blockhash => new light level */
/** @var int[][] blockhash => [x, y, z, new light level] */
protected $updateNodes = [];
/** @var \SplQueue */