mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Modernize property type declarations
This commit is contained in:
@@ -45,25 +45,21 @@ class Chunk{
|
||||
|
||||
private int $terrainDirtyFlags = 0;
|
||||
|
||||
/** @var bool|null */
|
||||
protected $lightPopulated = false;
|
||||
/** @var bool */
|
||||
protected $terrainPopulated = false;
|
||||
protected ?bool $lightPopulated = false;
|
||||
protected bool $terrainPopulated = false;
|
||||
|
||||
/**
|
||||
* @var \SplFixedArray|SubChunk[]
|
||||
* @phpstan-var \SplFixedArray<SubChunk>
|
||||
*/
|
||||
protected $subChunks;
|
||||
protected \SplFixedArray $subChunks;
|
||||
|
||||
/** @var Tile[] */
|
||||
protected $tiles = [];
|
||||
protected array $tiles = [];
|
||||
|
||||
/** @var HeightArray */
|
||||
protected $heightMap;
|
||||
protected HeightArray $heightMap;
|
||||
|
||||
/** @var BiomeArray */
|
||||
protected $biomeIds;
|
||||
protected BiomeArray $biomeIds;
|
||||
|
||||
/**
|
||||
* @param SubChunk[] $subChunks
|
||||
|
@@ -29,17 +29,15 @@ use pocketmine\world\WorldException;
|
||||
use function file_exists;
|
||||
|
||||
abstract class BaseWorldProvider implements WorldProvider{
|
||||
/** @var string */
|
||||
protected $path;
|
||||
/** @var WorldData */
|
||||
protected $worldData;
|
||||
protected WorldData $worldData;
|
||||
|
||||
public function __construct(string $path){
|
||||
public function __construct(
|
||||
protected string $path
|
||||
){
|
||||
if(!file_exists($path)){
|
||||
throw new WorldException("World does not exist");
|
||||
}
|
||||
|
||||
$this->path = $path;
|
||||
$this->worldData = $this->loadLevelData();
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ final class WorldProviderManager{
|
||||
* @var WorldProviderManagerEntry[]
|
||||
* @phpstan-var array<string, WorldProviderManagerEntry>
|
||||
*/
|
||||
protected $providers = [];
|
||||
protected array $providers = [];
|
||||
|
||||
private WritableWorldProviderManagerEntry $default;
|
||||
|
||||
|
@@ -32,20 +32,15 @@ use pocketmine\world\format\io\WorldData;
|
||||
use function file_exists;
|
||||
|
||||
abstract class BaseNbtWorldData implements WorldData{
|
||||
|
||||
/** @var string */
|
||||
protected $dataPath;
|
||||
|
||||
/** @var CompoundTag */
|
||||
protected $compoundTag;
|
||||
protected CompoundTag $compoundTag;
|
||||
|
||||
/**
|
||||
* @throws CorruptedWorldException
|
||||
* @throws UnsupportedWorldFormatException
|
||||
*/
|
||||
public function __construct(string $dataPath){
|
||||
$this->dataPath = $dataPath;
|
||||
|
||||
public function __construct(
|
||||
protected string $dataPath
|
||||
){
|
||||
if(!file_exists($this->dataPath)){
|
||||
throw new CorruptedWorldException("World data not found at $dataPath");
|
||||
}
|
||||
|
@@ -96,8 +96,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
|
||||
protected const CURRENT_LEVEL_CHUNK_VERSION = ChunkVersion::v1_2_0; //yes, I know this is wrong, but it ensures vanilla auto-fixes stuff we currently don't
|
||||
protected const CURRENT_LEVEL_SUBCHUNK_VERSION = SubChunkVersion::PALETTED_MULTI;
|
||||
|
||||
/** @var \LevelDB */
|
||||
protected $db;
|
||||
protected \LevelDB $db;
|
||||
|
||||
private static function checkForLevelDBExtension() : void{
|
||||
if(!extension_loaded('leveldb')){
|
||||
|
@@ -64,24 +64,20 @@ class RegionLoader{
|
||||
|
||||
public const FIRST_SECTOR = 2; //location table occupies 0 and 1
|
||||
|
||||
/** @var string */
|
||||
protected $filePath;
|
||||
/** @var resource */
|
||||
protected $filePointer;
|
||||
/** @var int */
|
||||
protected $nextSector = self::FIRST_SECTOR;
|
||||
protected int $nextSector = self::FIRST_SECTOR;
|
||||
/** @var RegionLocationTableEntry[]|null[] */
|
||||
protected $locationTable = [];
|
||||
/** @var RegionGarbageMap */
|
||||
protected $garbageTable;
|
||||
/** @var int */
|
||||
public $lastUsed = 0;
|
||||
protected array $locationTable = [];
|
||||
protected RegionGarbageMap $garbageTable;
|
||||
public int $lastUsed;
|
||||
|
||||
/**
|
||||
* @throws CorruptedRegionException
|
||||
*/
|
||||
private function __construct(string $filePath){
|
||||
$this->filePath = $filePath;
|
||||
private function __construct(
|
||||
protected string $filePath
|
||||
){
|
||||
$this->garbageTable = new RegionGarbageMap([]);
|
||||
$this->lastUsed = time();
|
||||
|
||||
|
@@ -73,7 +73,7 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
|
||||
}
|
||||
|
||||
/** @var RegionLoader[] */
|
||||
protected $regions = [];
|
||||
protected array $regions = [];
|
||||
|
||||
protected function loadLevelData() : WorldData{
|
||||
return new JavaWorldData(Path::join($this->getPath(), "level.dat"));
|
||||
|
Reference in New Issue
Block a user