Merge branch 'next-major' into modern-world-support

This commit is contained in:
Dylan K. Taylor 2022-06-04 18:43:11 +01:00
commit dab7686656
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
114 changed files with 436 additions and 863 deletions

View File

@ -32,8 +32,7 @@ class Barrel extends Spawnable implements Container, Nameable{
use NameableTrait; use NameableTrait;
use ContainerTrait; use ContainerTrait;
/** @var BarrelInventory */ protected BarrelInventory $inventory;
protected $inventory;
public function __construct(World $world, Vector3 $pos){ public function __construct(World $world, Vector3 $pos){
parent::__construct($world, $pos); parent::__construct($world, $pos);

View File

@ -44,10 +44,8 @@ class Chest extends Spawnable implements Container, Nameable{
public const TAG_PAIRZ = "pairz"; public const TAG_PAIRZ = "pairz";
public const TAG_PAIR_LEAD = "pairlead"; public const TAG_PAIR_LEAD = "pairlead";
/** @var ChestInventory */ protected ChestInventory $inventory;
protected $inventory; protected ?DoubleChestInventory $doubleInventory = null;
/** @var DoubleChestInventory|null */
protected $doubleInventory = null;
private ?int $pairX = null; private ?int $pairX = null;
private ?int $pairZ = null; private ?int $pairZ = null;

View File

@ -33,8 +33,7 @@ use pocketmine\nbt\tag\CompoundTag;
class Comparator extends Tile{ class Comparator extends Tile{
private const TAG_OUTPUT_SIGNAL = "OutputSignal"; //int private const TAG_OUTPUT_SIGNAL = "OutputSignal"; //int
/** @var int */ protected int $signalStrength = 0;
protected $signalStrength = 0;
public function getSignalStrength() : int{ public function getSignalStrength() : int{
return $this->signalStrength; return $this->signalStrength;

View File

@ -48,8 +48,7 @@ abstract class Furnace extends Spawnable implements Container, Nameable{
public const TAG_COOK_TIME = "CookTime"; public const TAG_COOK_TIME = "CookTime";
public const TAG_MAX_TIME = "MaxTime"; public const TAG_MAX_TIME = "MaxTime";
/** @var FurnaceInventory */ protected FurnaceInventory $inventory;
protected $inventory;
private int $remainingFuelTime = 0; private int $remainingFuelTime = 0;
private int $cookTime = 0; private int $cookTime = 0;
private int $maxFuelTime = 0; private int $maxFuelTime = 0;

View File

@ -38,11 +38,9 @@ class ShulkerBox extends Spawnable implements Container, Nameable{
public const TAG_FACING = "facing"; public const TAG_FACING = "facing";
/** @var int */ protected int $facing = Facing::NORTH;
protected $facing = Facing::NORTH;
/** @var ShulkerBoxInventory */ protected ShulkerBoxInventory $inventory;
protected $inventory;
public function __construct(World $world, Vector3 $pos){ public function __construct(World $world, Vector3 $pos){
parent::__construct($world, $pos); parent::__construct($world, $pos);

View File

@ -50,11 +50,8 @@ class Sign extends Spawnable{
return array_slice(array_pad(explode("\n", $blob), 4, ""), 0, 4); return array_slice(array_pad(explode("\n", $blob), 4, ""), 0, 4);
} }
/** @var SignText */ protected SignText $text;
protected $text; protected ?int $editorEntityRuntimeId = null;
/** @var int|null */
protected $editorEntityRuntimeId = null;
public function __construct(World $world, Vector3 $pos){ public function __construct(World $world, Vector3 $pos){
$this->text = new SignText(); $this->text = new SignText();

View File

@ -45,12 +45,9 @@ abstract class Tile{
public const TAG_Y = "y"; public const TAG_Y = "y";
public const TAG_Z = "z"; public const TAG_Z = "z";
/** @var Position */ protected Position $position;
protected $position; public bool $closed = false;
/** @var bool */ protected TimingsHandler $timings;
public $closed = false;
/** @var TimingsHandler */
protected $timings;
public function __construct(World $world, Vector3 $pos){ public function __construct(World $world, Vector3 $pos){
$this->position = Position::fromObject($pos, $world); $this->position = Position::fromObject($pos, $world);

View File

@ -26,8 +26,7 @@ namespace pocketmine\block\utils;
use pocketmine\math\Facing; use pocketmine\math\Facing;
trait AnyFacingTrait{ trait AnyFacingTrait{
/** @var int */ protected int $facing = Facing::DOWN;
protected $facing = Facing::DOWN;
public function getFacing() : int{ return $this->facing; } public function getFacing() : int{ return $this->facing; }

View File

@ -27,8 +27,7 @@ use pocketmine\math\Axis;
use pocketmine\math\Facing; use pocketmine\math\Facing;
trait HorizontalFacingTrait{ trait HorizontalFacingTrait{
/** @var int */ protected int $facing = Facing::NORTH;
protected $facing = Facing::NORTH;
public function getFacing() : int{ return $this->facing; } public function getFacing() : int{ return $this->facing; }

View File

@ -32,9 +32,7 @@ use pocketmine\player\Player;
use pocketmine\world\BlockTransaction; use pocketmine\world\BlockTransaction;
trait PillarRotationTrait{ trait PillarRotationTrait{
protected int $axis = Axis::Y;
/** @var int */
protected $axis = Axis::Y;
/** @see Axis */ /** @see Axis */
public function getAxis() : int{ return $this->axis; } public function getAxis() : int{ return $this->axis; }

View File

@ -53,17 +53,14 @@ abstract class Command{
private ?CommandMap $commandMap = null; private ?CommandMap $commandMap = null;
/** @var Translatable|string */ protected Translatable|string $description = "";
protected $description = "";
/** @var Translatable|string */ protected Translatable|string $usageMessage;
protected $usageMessage;
private ?string $permission = null; private ?string $permission = null;
private ?string $permissionMessage = null; private ?string $permissionMessage = null;
/** @var TimingsHandler|null */ public ?TimingsHandler $timings = null;
public $timings = null;
/** /**
* @param string[] $aliases * @param string[] $aliases

View File

@ -80,7 +80,7 @@ use function trim;
class SimpleCommandMap implements CommandMap{ class SimpleCommandMap implements CommandMap{
/** @var Command[] */ /** @var Command[] */
protected $knownCommands = []; protected array $knownCommands = [];
public function __construct(private Server $server){ public function __construct(private Server $server){
$this->setDefaultCommands(); $this->setDefaultCommands();

View File

@ -37,11 +37,8 @@ use const PHP_INT_MAX;
class ConsoleCommandSender implements CommandSender{ class ConsoleCommandSender implements CommandSender{
use PermissibleDelegateTrait; use PermissibleDelegateTrait;
/** /** @phpstan-var positive-int|null */
* @var int|null protected ?int $lineHeight = null;
* @phpstan-var positive-int|null
*/
protected $lineHeight = null;
public function __construct( public function __construct(
private Server $server, private Server $server,

View File

@ -35,27 +35,27 @@ class CraftingManager{
use DestructorCallbackTrait; use DestructorCallbackTrait;
/** @var ShapedRecipe[][] */ /** @var ShapedRecipe[][] */
protected $shapedRecipes = []; protected array $shapedRecipes = [];
/** @var ShapelessRecipe[][] */ /** @var ShapelessRecipe[][] */
protected $shapelessRecipes = []; protected array $shapelessRecipes = [];
/** /**
* @var FurnaceRecipeManager[] * @var FurnaceRecipeManager[]
* @phpstan-var array<int, FurnaceRecipeManager> * @phpstan-var array<int, FurnaceRecipeManager>
*/ */
protected $furnaceRecipeManagers; protected array $furnaceRecipeManagers;
/** /**
* @var PotionTypeRecipe[][] * @var PotionTypeRecipe[][]
* @phpstan-var array<string, array<string, PotionTypeRecipe>> * @phpstan-var array<string, array<string, PotionTypeRecipe>>
*/ */
protected $potionTypeRecipes = []; protected array $potionTypeRecipes = [];
/** /**
* @var PotionContainerChangeRecipe[][] * @var PotionContainerChangeRecipe[][]
* @phpstan-var array<int, array<string, PotionContainerChangeRecipe>> * @phpstan-var array<int, array<string, PotionContainerChangeRecipe>>
*/ */
protected $potionContainerChangeRecipes = []; protected array $potionContainerChangeRecipes = [];
/** @phpstan-var ObjectSet<\Closure() : void> */ /** @phpstan-var ObjectSet<\Closure() : void> */
private ObjectSet $recipeRegisteredCallbacks; private ObjectSet $recipeRegisteredCallbacks;

View File

@ -28,7 +28,7 @@ use pocketmine\utils\ObjectSet;
final class FurnaceRecipeManager{ final class FurnaceRecipeManager{
/** @var FurnaceRecipe[] */ /** @var FurnaceRecipe[] */
protected $furnaceRecipes = []; protected array $furnaceRecipes = [];
/** @phpstan-var ObjectSet<\Closure(FurnaceRecipe) : void> */ /** @phpstan-var ObjectSet<\Closure(FurnaceRecipe) : void> */
private ObjectSet $recipeRegisteredCallbacks; private ObjectSet $recipeRegisteredCallbacks;

View File

@ -48,32 +48,19 @@ class Attribute{
public const ZOMBIE_SPAWN_REINFORCEMENTS = self::MC_PREFIX . "zombie.spawn_reinforcements"; public const ZOMBIE_SPAWN_REINFORCEMENTS = self::MC_PREFIX . "zombie.spawn_reinforcements";
public const LAVA_MOVEMENT = self::MC_PREFIX . "lava_movement"; public const LAVA_MOVEMENT = self::MC_PREFIX . "lava_movement";
/** @var string */ protected float $currentValue;
protected $id; protected bool $desynchronized = true;
/** @var float */
protected $minValue;
/** @var float */
protected $maxValue;
/** @var float */
protected $defaultValue;
/** @var float */
protected $currentValue;
/** @var bool */
protected $shouldSend;
/** @var bool */ public function __construct(
protected $desynchronized = true; protected string $id,
protected float $minValue,
public function __construct(string $id, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true){ protected float $maxValue,
protected float $defaultValue,
protected bool $shouldSend = true
){
if($minValue > $maxValue || $defaultValue > $maxValue || $defaultValue < $minValue){ if($minValue > $maxValue || $defaultValue > $maxValue || $defaultValue < $minValue){
throw new \InvalidArgumentException("Invalid ranges: min value: $minValue, max value: $maxValue, $defaultValue: $defaultValue"); throw new \InvalidArgumentException("Invalid ranges: min value: $minValue, max value: $maxValue, $defaultValue: $defaultValue");
} }
$this->id = $id;
$this->minValue = $minValue;
$this->maxValue = $maxValue;
$this->defaultValue = $defaultValue;
$this->shouldSend = $shouldSend;
$this->currentValue = $this->defaultValue; $this->currentValue = $this->defaultValue;
} }

View File

@ -27,7 +27,7 @@ class PaintingMotive{
private static bool $initialized = false; private static bool $initialized = false;
/** @var PaintingMotive[] */ /** @var PaintingMotive[] */
protected static $motives = []; protected static array $motives = [];
public static function init() : void{ public static function init() : void{
foreach([ foreach([

View File

@ -33,8 +33,7 @@ abstract class Event{
private static int $eventCallDepth = 1; private static int $eventCallDepth = 1;
/** @var string|null */ protected ?string $eventName = null;
protected $eventName = null;
final public function getEventName() : string{ final public function getEventName() : string{
return $this->eventName ?? get_class($this); return $this->eventName ?? get_class($this);

View File

@ -35,30 +35,22 @@ use pocketmine\player\Player;
class BlockBreakEvent extends BlockEvent implements Cancellable{ class BlockBreakEvent extends BlockEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var Player */
protected $player;
/** @var Item */
protected $item;
/** @var bool */
protected $instaBreak = false;
/** @var Item[] */ /** @var Item[] */
protected $blockDrops = []; protected array $blockDrops = [];
/** @var int */
protected $xpDrops;
/** /**
* @param Item[] $drops * @param Item[] $drops
*/ */
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops = [], int $xpDrops = 0){ public function __construct(
protected Player $player,
Block $block,
protected Item $item,
protected bool $instaBreak = false,
array $drops = [],
protected int $xpDrops = 0
){
parent::__construct($block); parent::__construct($block);
$this->item = $item;
$this->player = $player;
$this->instaBreak = $instaBreak;
$this->setDrops($drops); $this->setDrops($drops);
$this->xpDrops = $xpDrops;
} }
/** /**

View File

@ -30,12 +30,9 @@ use pocketmine\block\Block;
use pocketmine\event\Event; use pocketmine\event\Event;
abstract class BlockEvent extends Event{ abstract class BlockEvent extends Event{
/** @var Block */ public function __construct(
protected $block; protected Block $block
){}
public function __construct(Block $block){
$this->block = $block;
}
public function getBlock() : Block{ public function getBlock() : Block{
return $this->block; return $this->block;

View File

@ -35,23 +35,14 @@ use pocketmine\player\Player;
class BlockPlaceEvent extends BlockEvent implements Cancellable{ class BlockPlaceEvent extends BlockEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var Player */ public function __construct(
protected $player; protected Player $player,
Block $blockPlace,
/** @var Item */ protected Block $blockReplace,
protected $item; protected Block $blockAgainst,
protected Item $item
/** @var Block */ ){
protected $blockReplace;
/** @var Block */
protected $blockAgainst;
public function __construct(Player $player, Block $blockPlace, Block $blockReplace, Block $blockAgainst, Item $item){
parent::__construct($blockPlace); parent::__construct($blockPlace);
$this->blockReplace = $blockReplace;
$this->blockAgainst = $blockAgainst;
$this->item = $item;
$this->player = $player;
} }
/** /**

View File

@ -27,8 +27,7 @@ use pocketmine\block\Block;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
class EntityCombustByBlockEvent extends EntityCombustEvent{ class EntityCombustByBlockEvent extends EntityCombustEvent{
/** @var Block */ protected Block $combuster;
protected $combuster;
public function __construct(Block $combuster, Entity $combustee, int $duration){ public function __construct(Block $combuster, Entity $combustee, int $duration){
parent::__construct($combustee, $duration); parent::__construct($combustee, $duration);

View File

@ -26,8 +26,7 @@ namespace pocketmine\event\entity;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
class EntityCombustByEntityEvent extends EntityCombustEvent{ class EntityCombustByEntityEvent extends EntityCombustEvent{
/** @var Entity */ protected Entity $combuster;
protected $combuster;
public function __construct(Entity $combuster, Entity $combustee, int $duration){ public function __construct(Entity $combuster, Entity $combustee, int $duration){
parent::__construct($combustee, $duration); parent::__construct($combustee, $duration);

View File

@ -33,8 +33,7 @@ use pocketmine\event\CancellableTrait;
class EntityCombustEvent extends EntityEvent implements Cancellable{ class EntityCombustEvent extends EntityEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var int */ protected int $duration;
protected $duration;
public function __construct(Entity $combustee, int $duration){ public function __construct(Entity $combustee, int $duration){
$this->entity = $combustee; $this->entity = $combustee;

View File

@ -33,11 +33,8 @@ use pocketmine\event\Event;
* @phpstan-template TEntity of Entity * @phpstan-template TEntity of Entity
*/ */
abstract class EntityEvent extends Event{ abstract class EntityEvent extends Event{
/** /** @phpstan-var TEntity */
* @var Entity protected Entity $entity;
* @phpstan-var TEntity
*/
protected $entity;
/** /**
* @return Entity * @return Entity

View File

@ -41,27 +41,20 @@ use pocketmine\world\Position;
class EntityExplodeEvent extends EntityEvent implements Cancellable{ class EntityExplodeEvent extends EntityEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var Position */
protected $position;
/** @var Block[] */
protected $blocks;
/** @var float */
protected $yield;
/** /**
* @param Block[] $blocks * @param Block[] $blocks
* @param float $yield 0-100 * @param float $yield 0-100
*/ */
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){ public function __construct(
Entity $entity,
protected Position $position,
protected array $blocks,
protected float $yield
){
$this->entity = $entity; $this->entity = $entity;
$this->position = $position;
$this->blocks = $blocks;
if($yield < 0.0 || $yield > 100.0){ if($yield < 0.0 || $yield > 100.0){
throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0"); throw new \InvalidArgumentException("Yield must be in range 0.0 - 100.0");
} }
$this->yield = $yield;
} }
public function getPosition() : Position{ public function getPosition() : Position{

View File

@ -38,16 +38,16 @@ use pocketmine\event\CancellableTrait;
class ExplosionPrimeEvent extends EntityEvent implements Cancellable{ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var float */
protected $force;
private bool $blockBreaking = true; private bool $blockBreaking = true;
public function __construct(Entity $entity, float $force){ public function __construct(
Entity $entity,
protected float $force
){
if($force <= 0){ if($force <= 0){
throw new \InvalidArgumentException("Explosion radius must be positive"); throw new \InvalidArgumentException("Explosion radius must be positive");
} }
$this->entity = $entity; $this->entity = $entity;
$this->force = $force;
} }
public function getForce() : float{ public function getForce() : float{

View File

@ -31,12 +31,9 @@ use pocketmine\inventory\Inventory;
use pocketmine\player\Player; use pocketmine\player\Player;
abstract class InventoryEvent extends Event{ abstract class InventoryEvent extends Event{
/** @var Inventory */ public function __construct(
protected $inventory; protected Inventory $inventory
){}
public function __construct(Inventory $inventory){
$this->inventory = $inventory;
}
public function getInventory() : Inventory{ public function getInventory() : Inventory{
return $this->inventory; return $this->inventory;

View File

@ -35,25 +35,16 @@ use pocketmine\utils\Utils;
class PlayerChatEvent extends PlayerEvent implements Cancellable{ class PlayerChatEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var string */
protected $message;
/** @var string */
protected $format;
/** @var CommandSender[] */
protected $recipients = [];
/** /**
* @param CommandSender[] $recipients * @param CommandSender[] $recipients
*/ */
public function __construct(Player $player, string $message, array $recipients, string $format = "chat.type.text"){ public function __construct(
Player $player,
protected string $message,
protected array $recipients,
protected string $format = "chat.type.text"
){
$this->player = $player; $this->player = $player;
$this->message = $message;
$this->format = $format;
$this->recipients = $recipients;
} }
public function getMessage() : string{ public function getMessage() : string{

View File

@ -41,12 +41,11 @@ use pocketmine\player\Player;
class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancellable{ class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var string */ public function __construct(
protected $message; Player $player,
protected string $message
public function __construct(Player $player, string $message){ ){
$this->player = $player; $this->player = $player;
$this->message = $message;
} }
public function getMessage() : string{ public function getMessage() : string{

View File

@ -35,19 +35,11 @@ use pocketmine\player\Player;
class PlayerDataSaveEvent extends Event implements Cancellable{ class PlayerDataSaveEvent extends Event implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var CompoundTag */
protected $data;
/** @var string */
protected $playerName;
public function __construct( public function __construct(
CompoundTag $nbt, protected CompoundTag $data,
string $playerName, protected string $playerName,
private ?Player $player private ?Player $player
){ ){}
$this->data = $nbt;
$this->playerName = $playerName;
}
/** /**
* Returns the data to be written to disk as a CompoundTag * Returns the data to be written to disk as a CompoundTag

View File

@ -35,8 +35,7 @@ use pocketmine\lang\Translatable;
use pocketmine\player\Player; use pocketmine\player\Player;
class PlayerDeathEvent extends EntityDeathEvent{ class PlayerDeathEvent extends EntityDeathEvent{
/** @var Player */ protected Player $player;
protected $player;
private Translatable|string $deathMessage; private Translatable|string $deathMessage;
private bool $keepInventory = false; private bool $keepInventory = false;

View File

@ -30,8 +30,7 @@ use pocketmine\event\Event;
use pocketmine\player\Player; use pocketmine\player\Player;
abstract class PlayerEvent extends Event{ abstract class PlayerEvent extends Event{
/** @var Player */ protected Player $player;
protected $player;
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->player; return $this->player;

View File

@ -46,23 +46,19 @@ class PlayerExhaustEvent extends EntityEvent implements Cancellable{
public const CAUSE_SPRINT_JUMPING = 10; public const CAUSE_SPRINT_JUMPING = 10;
public const CAUSE_CUSTOM = 11; public const CAUSE_CUSTOM = 11;
/** @var Human */
protected $player;
public function __construct( public function __construct(
Human $human, protected Human $human,
private float $amount, private float $amount,
private int $cause private int $cause
){ ){
$this->entity = $human; $this->entity = $human;
$this->player = $human;
} }
/** /**
* @return Human * @return Human
*/ */
public function getPlayer(){ public function getPlayer(){
return $this->player; return $this->human;
} }
public function getAmount() : float{ public function getAmount() : float{

View File

@ -35,9 +35,6 @@ use pocketmine\event\entity\EntityEvent;
class PlayerExperienceChangeEvent extends EntityEvent implements Cancellable{ class PlayerExperienceChangeEvent extends EntityEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var Human */
protected $entity;
public function __construct( public function __construct(
Human $player, Human $player,
private int $oldLevel, private int $oldLevel,

View File

@ -34,15 +34,14 @@ use pocketmine\player\Player;
class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable{ class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var GameMode */ public function __construct(
protected $gamemode; Player $player,
protected GameMode $newGamemode
public function __construct(Player $player, GameMode $newGamemode){ ){
$this->player = $player; $this->player = $player;
$this->gamemode = $newGamemode;
} }
public function getNewGamemode() : GameMode{ public function getNewGamemode() : GameMode{
return $this->gamemode; return $this->newGamemode;
} }
} }

View File

@ -40,28 +40,18 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
public const LEFT_CLICK_BLOCK = 0; public const LEFT_CLICK_BLOCK = 0;
public const RIGHT_CLICK_BLOCK = 1; public const RIGHT_CLICK_BLOCK = 1;
/** @var Block */ protected Vector3 $touchVector;
protected $blockTouched;
/** @var Vector3 */ public function __construct(
protected $touchVector; Player $player,
protected Item $item,
/** @var int */ protected Block $blockTouched,
protected $blockFace; ?Vector3 $touchVector,
protected int $blockFace,
/** @var Item */ protected int $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK
protected $item; ){
/** @var int */
protected $action;
public function __construct(Player $player, Item $item, Block $block, ?Vector3 $touchVector, int $face, int $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){
$this->player = $player; $this->player = $player;
$this->item = $item;
$this->blockTouched = $block;
$this->touchVector = $touchVector ?? new Vector3(0, 0, 0); $this->touchVector = $touchVector ?? new Vector3(0, 0, 0);
$this->blockFace = $face;
$this->action = $action;
} }
public function getAction() : int{ public function getAction() : int{

View File

@ -34,12 +34,11 @@ use pocketmine\player\Player;
* @see PlayerLoginEvent * @see PlayerLoginEvent
*/ */
class PlayerJoinEvent extends PlayerEvent{ class PlayerJoinEvent extends PlayerEvent{
/** @var string|Translatable */ public function __construct(
protected $joinMessage; Player $player,
protected Translatable|string $joinMessage
public function __construct(Player $player, Translatable|string $joinMessage){ ){
$this->player = $player; $this->player = $player;
$this->joinMessage = $joinMessage;
} }
public function setJoinMessage(Translatable|string $joinMessage) : void{ public function setJoinMessage(Translatable|string $joinMessage) : void{

View File

@ -34,16 +34,12 @@ use pocketmine\player\Player;
class PlayerKickEvent extends PlayerEvent implements Cancellable{ class PlayerKickEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var Translatable|string */ public function __construct(
protected $quitMessage; Player $player,
protected string $reason,
/** @var string */ protected Translatable|string $quitMessage
protected $reason; ){
public function __construct(Player $player, string $reason, Translatable|string $quitMessage){
$this->player = $player; $this->player = $player;
$this->quitMessage = $quitMessage;
$this->reason = $reason;
} }
/** /**

View File

@ -35,12 +35,11 @@ use pocketmine\player\Player;
class PlayerLoginEvent extends PlayerEvent implements Cancellable{ class PlayerLoginEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var string */ public function __construct(
protected $kickMessage; Player $player,
protected string $kickMessage
public function __construct(Player $player, string $kickMessage){ ){
$this->player = $player; $this->player = $player;
$this->kickMessage = $kickMessage;
} }
public function setKickMessage(string $kickMessage) : void{ public function setKickMessage(string $kickMessage) : void{

View File

@ -52,20 +52,15 @@ class PlayerPreLoginEvent extends Event implements Cancellable{
self::KICK_REASON_BANNED self::KICK_REASON_BANNED
]; ];
/** @var bool */
protected $authRequired;
/** @var string[] reason const => associated message */ /** @var string[] reason const => associated message */
protected $kickReasons = []; protected array $kickReasons = [];
public function __construct( public function __construct(
private PlayerInfo $playerInfo, private PlayerInfo $playerInfo,
private string $ip, private string $ip,
private int $port, private int $port,
bool $authRequired protected bool $authRequired
){ ){}
$this->authRequired = $authRequired;
}
/** /**
* Returns an object containing self-proclaimed information about the connecting player. * Returns an object containing self-proclaimed information about the connecting player.

View File

@ -37,16 +37,12 @@ use pocketmine\player\Player;
* @see PlayerKickEvent * @see PlayerKickEvent
*/ */
class PlayerQuitEvent extends PlayerEvent{ class PlayerQuitEvent extends PlayerEvent{
public function __construct(
/** @var Translatable|string */ Player $player,
protected $quitMessage; protected Translatable|string $quitMessage,
/** @var string */ protected string $quitReason
protected $quitReason; ){
public function __construct(Player $player, Translatable|string $quitMessage, string $quitReason){
$this->player = $player; $this->player = $player;
$this->quitMessage = $quitMessage;
$this->quitReason = $quitReason;
} }
/** /**

View File

@ -31,12 +31,11 @@ use pocketmine\world\Position;
* Called when a player is respawned * Called when a player is respawned
*/ */
class PlayerRespawnEvent extends PlayerEvent{ class PlayerRespawnEvent extends PlayerEvent{
/** @var Position */ public function __construct(
protected $position; Player $player,
protected Position $position
public function __construct(Player $player, Position $position){ ){
$this->player = $player; $this->player = $player;
$this->position = $position;
} }
public function getRespawnPosition() : Position{ public function getRespawnPosition() : Position{

View File

@ -30,12 +30,11 @@ use pocketmine\player\Player;
class PlayerToggleFlightEvent extends PlayerEvent implements Cancellable{ class PlayerToggleFlightEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var bool */ public function __construct(
protected $isFlying; Player $player,
protected bool $isFlying
public function __construct(Player $player, bool $isFlying){ ){
$this->player = $player; $this->player = $player;
$this->isFlying = $isFlying;
} }
public function isFlying() : bool{ public function isFlying() : bool{

View File

@ -30,12 +30,11 @@ use pocketmine\player\Player;
class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{ class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var bool */ public function __construct(
protected $isSneaking; Player $player,
protected bool $isSneaking
public function __construct(Player $player, bool $isSneaking){ ){
$this->player = $player; $this->player = $player;
$this->isSneaking = $isSneaking;
} }
public function isSneaking() : bool{ public function isSneaking() : bool{

View File

@ -30,12 +30,11 @@ use pocketmine\player\Player;
class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable{ class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var bool */ public function __construct(
protected $isSprinting; Player $player,
protected bool $isSprinting
public function __construct(Player $player, bool $isSprinting){ ){
$this->player = $player; $this->player = $player;
$this->isSprinting = $isSprinting;
} }
public function isSprinting() : bool{ public function isSprinting() : bool{

View File

@ -33,18 +33,13 @@ use pocketmine\player\Player;
class PlayerTransferEvent extends PlayerEvent implements Cancellable{ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var string */ public function __construct(
protected $address; Player $player,
/** @var int */ protected string $address,
protected $port = 19132; protected int $port,
/** @var string */ protected string $message
protected $message; ){
public function __construct(Player $player, string $address, int $port, string $message){
$this->player = $player; $this->player = $player;
$this->address = $address;
$this->port = $port;
$this->message = $message;
} }
/** /**

View File

@ -44,16 +44,10 @@ use pocketmine\event\CancellableTrait;
class CommandEvent extends ServerEvent implements Cancellable{ class CommandEvent extends ServerEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** @var string */ public function __construct(
protected $command; protected CommandSender $sender,
protected string $command
/** @var CommandSender */ ){}
protected $sender;
public function __construct(CommandSender $sender, string $command){
$this->sender = $sender;
$this->command = $command;
}
public function getSender() : CommandSender{ public function getSender() : CommandSender{
return $this->sender; return $this->sender;

View File

@ -26,12 +26,9 @@ namespace pocketmine\event\server;
use pocketmine\network\NetworkInterface; use pocketmine\network\NetworkInterface;
class NetworkInterfaceEvent extends ServerEvent{ class NetworkInterfaceEvent extends ServerEvent{
/** @var NetworkInterface */ public function __construct(
protected $interface; protected NetworkInterface $interface
){}
public function __construct(NetworkInterface $interface){
$this->interface = $interface;
}
public function getInterface() : NetworkInterface{ public function getInterface() : NetworkInterface{
return $this->interface; return $this->interface;

View File

@ -32,11 +32,9 @@ class ArmorInventory extends SimpleInventory{
public const SLOT_LEGS = 2; public const SLOT_LEGS = 2;
public const SLOT_FEET = 3; public const SLOT_FEET = 3;
/** @var Living */ public function __construct(
protected $holder; protected Living $holder
){
public function __construct(Living $holder){
$this->holder = $holder;
parent::__construct(4); parent::__construct(4);
} }

View File

@ -37,15 +37,14 @@ use function spl_object_id;
* This class provides everything needed to implement an inventory, minus the underlying storage system. * This class provides everything needed to implement an inventory, minus the underlying storage system.
*/ */
abstract class BaseInventory implements Inventory{ abstract class BaseInventory implements Inventory{
/** @var int */ protected int $maxStackSize = Inventory::MAX_STACK;
protected $maxStackSize = Inventory::MAX_STACK;
/** @var Player[] */ /** @var Player[] */
protected $viewers = []; protected array $viewers = [];
/** /**
* @var InventoryListener[]|ObjectSet * @var InventoryListener[]|ObjectSet
* @phpstan-var ObjectSet<InventoryListener> * @phpstan-var ObjectSet<InventoryListener>
*/ */
protected $listeners; protected ObjectSet $listeners;
public function __construct(){ public function __construct(){
$this->listeners = new ObjectSet(); $this->listeners = new ObjectSet();

View File

@ -26,18 +26,13 @@ namespace pocketmine\inventory;
use pocketmine\player\Player; use pocketmine\player\Player;
class PlayerCursorInventory extends SimpleInventory implements TemporaryInventory{ class PlayerCursorInventory extends SimpleInventory implements TemporaryInventory{
/** @var Player */ public function __construct(
protected $holder; protected Player $holder
){
public function __construct(Player $holder){
$this->holder = $holder;
parent::__construct(1); parent::__construct(1);
} }
/** public function getHolder() : Player{
* @return Player
*/
public function getHolder(){
return $this->holder; return $this->holder;
} }
} }

View File

@ -30,17 +30,14 @@ use pocketmine\utils\ObjectSet;
class PlayerInventory extends SimpleInventory{ class PlayerInventory extends SimpleInventory{
/** @var Human */ protected Human $holder;
protected $holder; protected int $itemInHandIndex = 0;
/** @var int */
protected $itemInHandIndex = 0;
/** /**
* @var \Closure[]|ObjectSet * @var \Closure[]|ObjectSet
* @phpstan-var ObjectSet<\Closure(int $oldIndex) : void> * @phpstan-var ObjectSet<\Closure(int $oldIndex) : void>
*/ */
protected $heldItemIndexChangeListeners; protected ObjectSet $heldItemIndexChangeListeners;
public function __construct(Human $player){ public function __construct(Human $player){
$this->holder = $player; $this->holder = $player;
@ -123,10 +120,7 @@ class PlayerInventory extends SimpleInventory{
return 9; return 9;
} }
/** public function getHolder() : Human{
* @return Human|Player
*/
public function getHolder(){
return $this->holder; return $this->holder;
} }
} }

View File

@ -48,15 +48,13 @@ use function intdiv;
* results, with no remainder. Any leftovers are expected to be emitted back to the crafting grid. * results, with no remainder. Any leftovers are expected to be emitted back to the crafting grid.
*/ */
class CraftingTransaction extends InventoryTransaction{ class CraftingTransaction extends InventoryTransaction{
/** @var CraftingRecipe|null */ protected ?CraftingRecipe $recipe;
protected $recipe; protected ?int $repetitions;
/** @var int|null */
protected $repetitions;
/** @var Item[] */ /** @var Item[] */
protected $inputs = []; protected array $inputs = [];
/** @var Item[] */ /** @var Item[] */
protected $outputs = []; protected array $outputs = [];
private CraftingManager $craftingManager; private CraftingManager $craftingManager;

View File

@ -55,22 +55,21 @@ use function spl_object_id;
* @see InventoryAction * @see InventoryAction
*/ */
class InventoryTransaction{ class InventoryTransaction{
/** @var bool */ protected bool $hasExecuted = false;
protected $hasExecuted = false;
/** @var Player */
protected $source;
/** @var Inventory[] */ /** @var Inventory[] */
protected $inventories = []; protected array $inventories = [];
/** @var InventoryAction[] */ /** @var InventoryAction[] */
protected $actions = []; protected array $actions = [];
/** /**
* @param InventoryAction[] $actions * @param InventoryAction[] $actions
*/ */
public function __construct(Player $source, array $actions = []){ public function __construct(
$this->source = $source; protected Player $source,
array $actions = []
){
foreach($actions as $action){ foreach($actions as $action){
$this->addAction($action); $this->addAction($action);
} }

View File

@ -32,15 +32,10 @@ use pocketmine\player\Player;
* Represents an action involving a change that applies in some way to an inventory or other item-source. * Represents an action involving a change that applies in some way to an inventory or other item-source.
*/ */
abstract class InventoryAction{ abstract class InventoryAction{
/** @var Item */ public function __construct(
protected $sourceItem; protected Item $sourceItem,
/** @var Item */ protected Item $targetItem
protected $targetItem; ){}
public function __construct(Item $sourceItem, Item $targetItem){
$this->sourceItem = $sourceItem;
$this->targetItem = $targetItem;
}
/** /**
* Returns the item that was present before the action took place. * Returns the item that was present before the action took place.

View File

@ -33,15 +33,13 @@ use pocketmine\player\Player;
* Represents an action causing a change in an inventory slot. * Represents an action causing a change in an inventory slot.
*/ */
class SlotChangeAction extends InventoryAction{ class SlotChangeAction extends InventoryAction{
public function __construct(
/** @var Inventory */ protected Inventory $inventory,
protected $inventory; private int $inventorySlot,
private int $inventorySlot; Item $sourceItem,
Item $targetItem
public function __construct(Inventory $inventory, int $inventorySlot, Item $sourceItem, Item $targetItem){ ){
parent::__construct($sourceItem, $targetItem); parent::__construct($sourceItem, $targetItem);
$this->inventory = $inventory;
$this->inventorySlot = $inventorySlot;
} }
/** /**

View File

@ -42,8 +42,7 @@ class Armor extends Durable{
private ArmorTypeInfo $armorInfo; private ArmorTypeInfo $armorInfo;
/** @var Color|null */ protected ?Color $customColor = null;
protected $customColor = null;
public function __construct(ItemIdentifier $identifier, string $name, ArmorTypeInfo $info){ public function __construct(ItemIdentifier $identifier, string $name, ArmorTypeInfo $info){
parent::__construct($identifier, $name); parent::__construct($identifier, $name);

View File

@ -29,9 +29,7 @@ use function lcg_value;
use function min; use function min;
abstract class Durable extends Item{ abstract class Durable extends Item{
protected int $damage = 0;
/** @var int */
protected $damage = 0;
private bool $unbreakable = false; private bool $unbreakable = false;
public function getMeta() : int{ public function getMeta() : int{

View File

@ -65,36 +65,28 @@ class Item implements \JsonSerializable{
public const TAG_DISPLAY_NAME = "Name"; public const TAG_DISPLAY_NAME = "Name";
public const TAG_DISPLAY_LORE = "Lore"; public const TAG_DISPLAY_LORE = "Lore";
private ItemIdentifier $identifier;
private CompoundTag $nbt; private CompoundTag $nbt;
/** @var int */ protected int $count = 1;
protected $count = 1;
/** @var string */
protected $name;
//TODO: this stuff should be moved to itemstack properties, not mushed in with type properties //TODO: this stuff should be moved to itemstack properties, not mushed in with type properties
/** @var string */ protected string $customName = "";
protected $customName = "";
/** @var string[] */ /** @var string[] */
protected $lore = []; protected array $lore = [];
/** /** TODO: this needs to die in a fire */
* TODO: this needs to die in a fire protected ?CompoundTag $blockEntityTag = null;
* @var CompoundTag|null
*/
protected $blockEntityTag = null;
/** /**
* @var string[] * @var string[]
* @phpstan-var array<string, string> * @phpstan-var array<string, string>
*/ */
protected $canPlaceOn = []; protected array $canPlaceOn = [];
/** /**
* @var string[] * @var string[]
* @phpstan-var array<string, string> * @phpstan-var array<string, string>
*/ */
protected $canDestroy; protected array $canDestroy = [];
/** /**
* Constructs a new Item type. This constructor should ONLY be used when constructing a new item TYPE to register * Constructs a new Item type. This constructor should ONLY be used when constructing a new item TYPE to register
@ -103,12 +95,10 @@ class Item implements \JsonSerializable{
* NOTE: This should NOT BE USED for creating items to set into an inventory. Use {@link ItemFactory#get} for that * NOTE: This should NOT BE USED for creating items to set into an inventory. Use {@link ItemFactory#get} for that
* purpose. * purpose.
*/ */
public function __construct(ItemIdentifier $identifier, string $name = "Unknown"){ public function __construct(
$this->identifier = $identifier; private ItemIdentifier $identifier,
$this->name = $name; protected string $name = "Unknown"
){
$this->canPlaceOn = [];
$this->canDestroy = [];
$this->nbt = new CompoundTag(); $this->nbt = new CompoundTag();
} }

View File

@ -34,7 +34,7 @@ use function spl_object_id;
*/ */
trait ItemEnchantmentHandlingTrait{ trait ItemEnchantmentHandlingTrait{
/** @var EnchantmentInstance[] */ /** @var EnchantmentInstance[] */
protected $enchantments = []; protected array $enchantments = [];
public function hasEnchantments() : bool{ public function hasEnchantments() : bool{
return count($this->enchantments) > 0; return count($this->enchantments) > 0;

View File

@ -24,9 +24,7 @@ declare(strict_types=1);
namespace pocketmine\item; namespace pocketmine\item;
abstract class TieredTool extends Tool{ abstract class TieredTool extends Tool{
protected ToolTier $tier;
/** @var ToolTier */
protected $tier;
public function __construct(ItemIdentifier $identifier, string $name, ToolTier $tier){ public function __construct(ItemIdentifier $identifier, string $name, ToolTier $tier){
parent::__construct($identifier, $name); parent::__construct($identifier, $name);

View File

@ -29,10 +29,9 @@ use function array_flip;
use function floor; use function floor;
class ProtectionEnchantment extends Enchantment{ class ProtectionEnchantment extends Enchantment{
/** @var float */ protected float $typeModifier;
protected $typeModifier;
/** @var int[]|null */ /** @var int[]|null */
protected $applicableDamageTypes = null; protected ?array $applicableDamageTypes = null;
/** /**
* ProtectionEnchantment constructor. * ProtectionEnchantment constructor.

View File

@ -81,19 +81,17 @@ class Language{
throw new LanguageNotFoundException("Language directory $path does not exist or is not a directory"); throw new LanguageNotFoundException("Language directory $path does not exist or is not a directory");
} }
/** @var string */ protected string $langName;
protected $langName;
/** /**
* @var string[] * @var string[]
* @phpstan-var array<string, string> * @phpstan-var array<string, string>
*/ */
protected $lang = []; protected array $lang = [];
/** /**
* @var string[] * @var string[]
* @phpstan-var array<string, string> * @phpstan-var array<string, string>
*/ */
protected $fallbackLang = []; protected array $fallbackLang = [];
/** /**
* @throws LanguageNotFoundException * @throws LanguageNotFoundException

View File

@ -24,18 +24,16 @@ declare(strict_types=1);
namespace pocketmine\lang; namespace pocketmine\lang;
final class Translatable{ final class Translatable{
/** @var string $text */
protected $text;
/** @var string[]|Translatable[] $params */ /** @var string[]|Translatable[] $params */
protected $params = []; protected array $params = [];
/** /**
* @param (float|int|string|Translatable)[] $params * @param (float|int|string|Translatable)[] $params
*/ */
public function __construct(string $text, array $params = []){ public function __construct(
$this->text = $text; protected string $text,
array $params = []
){
foreach($params as $k => $param){ foreach($params as $k => $param){
if(!($param instanceof Translatable)){ if(!($param instanceof Translatable)){
$this->params[$k] = (string) $param; $this->params[$k] = (string) $param;

View File

@ -39,16 +39,10 @@ class ChunkRequestTask extends AsyncTask{
private const TLS_KEY_PROMISE = "promise"; private const TLS_KEY_PROMISE = "promise";
private const TLS_KEY_ERROR_HOOK = "errorHook"; private const TLS_KEY_ERROR_HOOK = "errorHook";
/** @var string */ protected string $chunk;
protected $chunk; protected int $chunkX;
/** @var int */ protected int $chunkZ;
protected $chunkX; protected Compressor $compressor;
/** @var int */
protected $chunkZ;
/** @var Compressor */
protected $compressor;
private string $tiles; private string $tiles;
/** /**

View File

@ -34,8 +34,7 @@ use function substr;
class EncryptionContext{ class EncryptionContext{
private const CHECKSUM_ALGO = "sha256"; private const CHECKSUM_ALGO = "sha256";
/** @var bool */ public static bool $ENABLED = true;
public static $ENABLED = true;
private string $key; private string $key;

View File

@ -135,16 +135,12 @@ use const JSON_THROW_ON_ERROR;
class InGamePacketHandler extends PacketHandler{ class InGamePacketHandler extends PacketHandler{
private const MAX_FORM_RESPONSE_DEPTH = 2; //modal/simple will be 1, custom forms 2 - they will never contain anything other than string|int|float|bool|null private const MAX_FORM_RESPONSE_DEPTH = 2; //modal/simple will be 1, custom forms 2 - they will never contain anything other than string|int|float|bool|null
/** @var CraftingTransaction|null */ protected ?CraftingTransaction $craftingTransaction = null;
protected $craftingTransaction = null;
/** @var float */ protected float $lastRightClickTime = 0.0;
protected $lastRightClickTime = 0.0; protected ?UseItemTransactionData $lastRightClickData = null;
/** @var UseItemTransactionData|null */
protected $lastRightClickData = null;
/** @var bool */ public bool $forceMoveSync = false;
public $forceMoveSync = false;
public function __construct( public function __construct(
private Player $player, private Player $player,

View File

@ -40,62 +40,22 @@ use function register_shutdown_function;
use const PTHREADS_INHERIT_NONE; use const PTHREADS_INHERIT_NONE;
class RakLibServer extends Thread{ class RakLibServer extends Thread{
private InternetAddress $address; protected bool $cleanShutdown = false;
protected bool $ready = false;
/** @var \ThreadedLogger */ protected string $mainPath;
protected $logger; public ?RakLibThreadCrashInfo $crashInfo = null;
/** @var bool */
protected $cleanShutdown = false;
/** @var bool */
protected $ready = false;
/** @var \Threaded */
protected $mainToThreadBuffer;
/** @var \Threaded */
protected $threadToMainBuffer;
/** @var string */
protected $mainPath;
/** @var int */
protected $serverId;
/** @var int */
protected $maxMtuSize;
private int $protocolVersion;
/** @var SleeperNotifier */
protected $mainThreadNotifier;
/** @var RakLibThreadCrashInfo|null */
public $crashInfo = null;
public function __construct( public function __construct(
\ThreadedLogger $logger, protected \ThreadedLogger $logger,
\Threaded $mainToThreadBuffer, protected \Threaded $mainToThreadBuffer,
\Threaded $threadToMainBuffer, protected \Threaded $threadToMainBuffer,
InternetAddress $address, protected InternetAddress $address,
int $serverId, protected int $serverId,
int $maxMtuSize, protected int $maxMtuSize,
int $protocolVersion, protected int $protocolVersion,
SleeperNotifier $sleeper protected SleeperNotifier $mainThreadNotifier
){ ){
$this->address = $address;
$this->serverId = $serverId;
$this->maxMtuSize = $maxMtuSize;
$this->logger = $logger;
$this->mainToThreadBuffer = $mainToThreadBuffer;
$this->threadToMainBuffer = $threadToMainBuffer;
$this->mainPath = \pocketmine\PATH; $this->mainPath = \pocketmine\PATH;
$this->protocolVersion = $protocolVersion;
$this->mainThreadNotifier = $sleeper;
} }
/** /**

View File

@ -33,8 +33,7 @@ use function strtolower;
use function trim; use function trim;
class BanEntry{ class BanEntry{
/** @var string */ public static string $format = "Y-m-d H:i:s O";
public static $format = "Y-m-d H:i:s O";
private string $name; private string $name;
private \DateTime $creationDate; private \DateTime $creationDate;

View File

@ -38,9 +38,9 @@ class PermissionManager{
} }
/** @var Permission[] */ /** @var Permission[] */
protected $permissions = []; protected array $permissions = [];
/** @var PermissibleInternal[][] */ /** @var PermissibleInternal[][] */
protected $permSubs = []; protected array $permSubs = [];
public function getPermission(string $name) : ?Permission{ public function getPermission(string $name) : ?Permission{
return $this->permissions[$name] ?? null; return $this->permissions[$name] ?? null;

View File

@ -46,7 +46,7 @@ final class GameMode{
} }
/** @var self[] */ /** @var self[] */
protected static $aliasMap = []; protected static array $aliasMap = [];
protected static function setup() : void{ protected static function setup() : void{
self::registerAll( self::registerAll(

View File

@ -28,15 +28,15 @@ final class PluginLoadTriage{
* @var PluginLoadTriageEntry[] * @var PluginLoadTriageEntry[]
* @phpstan-var array<string, PluginLoadTriageEntry> * @phpstan-var array<string, PluginLoadTriageEntry>
*/ */
public $plugins = []; public array $plugins = [];
/** /**
* @var string[][] * @var string[][]
* @phpstan-var array<string, list<string>> * @phpstan-var array<string, list<string>>
*/ */
public $dependencies = []; public array $dependencies = [];
/** /**
* @var string[][] * @var string[][]
* @phpstan-var array<string, list<string>> * @phpstan-var array<string, list<string>>
*/ */
public $softDependencies = []; public array $softDependencies = [];
} }

View File

@ -70,10 +70,10 @@ use function strtolower;
*/ */
class PluginManager{ class PluginManager{
/** @var Plugin[] */ /** @var Plugin[] */
protected $plugins = []; protected array $plugins = [];
/** @var Plugin[] */ /** @var Plugin[] */
protected $enabledPlugins = []; protected array $enabledPlugins = [];
private bool $loadPluginsGuard = false; private bool $loadPluginsGuard = false;
@ -81,7 +81,7 @@ class PluginManager{
* @var PluginLoader[] * @var PluginLoader[]
* @phpstan-var array<class-string<PluginLoader>, PluginLoader> * @phpstan-var array<class-string<PluginLoader>, PluginLoader>
*/ */
protected $fileAssociations = []; protected array $fileAssociations = [];
public function __construct( public function __construct(
private Server $server, private Server $server,

View File

@ -43,9 +43,6 @@ final class PromiseSharedData{
public bool $resolved = false; public bool $resolved = false;
/** /** @phpstan-var TValue|null */
* @var mixed public mixed $result = null;
* @phpstan-var TValue|null
*/
public $result = null;
} }

View File

@ -41,15 +41,9 @@ use function preg_match;
use function strlen; use function strlen;
class ZippedResourcePack implements ResourcePack{ class ZippedResourcePack implements ResourcePack{
protected string $path;
/** @var string */ protected Manifest $manifest;
protected $path; protected ?string $sha256 = null;
/** @var Manifest */
protected $manifest;
/** @var string|null */
protected $sha256 = null;
/** @var resource */ /** @var resource */
protected $fileResource; protected $fileResource;

View File

@ -42,9 +42,6 @@ use const PTHREADS_INHERIT_INI;
class AsyncPool{ class AsyncPool{
private const WORKER_START_OPTIONS = PTHREADS_INHERIT_INI; private const WORKER_START_OPTIONS = PTHREADS_INHERIT_INI;
/** @var int */
protected $size;
/** /**
* @var \SplQueue[]|AsyncTask[][] * @var \SplQueue[]|AsyncTask[][]
* @phpstan-var array<int, \SplQueue<AsyncTask>> * @phpstan-var array<int, \SplQueue<AsyncTask>>
@ -69,14 +66,12 @@ class AsyncPool{
private array $workerStartHooks = []; private array $workerStartHooks = [];
public function __construct( public function __construct(
int $size, protected int $size,
private int $workerMemoryLimit, private int $workerMemoryLimit,
private \ClassLoader $classLoader, private \ClassLoader $classLoader,
private \ThreadedLogger $logger, private \ThreadedLogger $logger,
private SleeperHandler $eventLoop private SleeperHandler $eventLoop
){ ){}
$this->size = $size;
}
/** /**
* Returns the maximum size of the pool. Note that there may be less active workers than this number. * Returns the maximum size of the pool. Note that there may be less active workers than this number.

View File

@ -59,8 +59,7 @@ abstract class AsyncTask extends \Threaded{
/** @var AsyncWorker|null $worker */ /** @var AsyncWorker|null $worker */
public $worker = null; public $worker = null;
/** @var \Threaded */ public \Threaded $progressUpdates;
public $progressUpdates;
private string|int|bool|null|float $result = null; private string|int|bool|null|float $result = null;
private bool $serialized = false; private bool $serialized = false;

View File

@ -27,34 +27,24 @@ use pocketmine\timings\Timings;
use pocketmine\timings\TimingsHandler; use pocketmine\timings\TimingsHandler;
class TaskHandler{ class TaskHandler{
protected int $nextRun;
/** @var Task */ protected bool $cancelled = false;
protected $task;
/** @var int */
protected $delay;
/** @var int */
protected $period;
/** @var int */
protected $nextRun;
/** @var bool */
protected $cancelled = false;
private TimingsHandler $timings; private TimingsHandler $timings;
private string $taskName; private string $taskName;
private string $ownerName; private string $ownerName;
public function __construct(Task $task, int $delay = -1, int $period = -1, ?string $ownerName = null){ public function __construct(
protected Task $task,
protected int $delay = -1,
protected int $period = -1,
?string $ownerName = null
){
if($task->getHandler() !== null){ if($task->getHandler() !== null){
throw new \InvalidArgumentException("Cannot assign multiple handlers to the same task"); throw new \InvalidArgumentException("Cannot assign multiple handlers to the same task");
} }
$this->task = $task;
$this->delay = $delay;
$this->period = $period;
$this->taskName = $task->getName(); $this->taskName = $task->getName();
$this->ownerName = $ownerName ?? "Unknown"; $this->ownerName = $ownerName ?? "Unknown";
$this->timings = Timings::getScheduledTaskTimings($this, $period); $this->timings = Timings::getScheduledTaskTimings($this, $period);

View File

@ -33,20 +33,16 @@ use pocketmine\utils\ReversePriorityQueue;
class TaskScheduler{ class TaskScheduler{
private bool $enabled = true; private bool $enabled = true;
/** /** @phpstan-var ReversePriorityQueue<int, TaskHandler> */
* @var ReversePriorityQueue protected ReversePriorityQueue $queue;
* @phpstan-var ReversePriorityQueue<int, TaskHandler>
*/
protected $queue;
/** /**
* @var ObjectSet|TaskHandler[] * @var ObjectSet|TaskHandler[]
* @phpstan-var ObjectSet<TaskHandler> * @phpstan-var ObjectSet<TaskHandler>
*/ */
protected $tasks; protected ObjectSet $tasks;
/** @var int */ protected int $currentTick = 0;
protected $currentTick = 0;
public function __construct( public function __construct(
private ?string $owner = null private ?string $owner = null

View File

@ -49,10 +49,8 @@ class SendUsageTask extends AsyncTask{
public const TYPE_STATUS = 2; public const TYPE_STATUS = 2;
public const TYPE_CLOSE = 3; public const TYPE_CLOSE = 3;
/** @var string */ public string $endpoint;
public $endpoint; public string $data;
/** @var string */
public $data;
/** /**
* @param string[] $playerList * @param string[] $playerList

View File

@ -30,11 +30,9 @@ use function error_reporting;
trait CommonThreadPartsTrait{ trait CommonThreadPartsTrait{
/** @var \Threaded|\ClassLoader[]|null */ /** @var \Threaded|\ClassLoader[]|null */
private ?\Threaded $classLoaders = null; private ?\Threaded $classLoaders = null;
/** @var string|null */ protected ?string $composerAutoloaderPath;
protected $composerAutoloaderPath;
/** @var bool */ protected bool $isKilled = false;
protected $isKilled = false;
/** /**
* @return \ClassLoader[] * @return \ClassLoader[]

View File

@ -36,96 +36,58 @@ abstract class Timings{
private static bool $initialized = false; private static bool $initialized = false;
/** @var TimingsHandler */ public static TimingsHandler $fullTick;
public static $fullTick; public static TimingsHandler $serverTick;
/** @var TimingsHandler */ public static TimingsHandler $memoryManager;
public static $serverTick; public static TimingsHandler $garbageCollector;
/** @var TimingsHandler */ public static TimingsHandler $titleTick;
public static $memoryManager; public static TimingsHandler $playerNetworkSend;
/** @var TimingsHandler */ public static TimingsHandler $playerNetworkSendCompress;
public static $garbageCollector; public static TimingsHandler $playerNetworkSendEncrypt;
/** @var TimingsHandler */ public static TimingsHandler $playerNetworkReceive;
public static $titleTick; public static TimingsHandler $playerNetworkReceiveDecompress;
/** @var TimingsHandler */ public static TimingsHandler $playerNetworkReceiveDecrypt;
public static $playerNetworkSend; public static TimingsHandler $playerChunkOrder;
/** @var TimingsHandler */ public static TimingsHandler $playerChunkSend;
public static $playerNetworkSendCompress; public static TimingsHandler $connection;
/** @var TimingsHandler */ public static TimingsHandler $scheduler;
public static $playerNetworkSendEncrypt; public static TimingsHandler $serverCommand;
/** @var TimingsHandler */ public static TimingsHandler $worldLoad;
public static $playerNetworkReceive; public static TimingsHandler $worldSave;
/** @var TimingsHandler */ public static TimingsHandler $population;
public static $playerNetworkReceiveDecompress; public static TimingsHandler $generationCallback;
/** @var TimingsHandler */ public static TimingsHandler $permissibleCalculation;
public static $playerNetworkReceiveDecrypt; public static TimingsHandler $permissibleCalculationDiff;
/** @var TimingsHandler */ public static TimingsHandler $permissibleCalculationCallback;
public static $playerChunkOrder; public static TimingsHandler $entityMove;
/** @var TimingsHandler */ public static TimingsHandler $playerCheckNearEntities;
public static $playerChunkSend; public static TimingsHandler $tickEntity;
/** @var TimingsHandler */ public static TimingsHandler $tickTileEntity;
public static $connection; public static TimingsHandler $entityBaseTick;
/** @var TimingsHandler */ public static TimingsHandler $livingEntityBaseTick;
public static $scheduler;
/** @var TimingsHandler */
public static $serverCommand;
/** @var TimingsHandler */
public static $worldLoad;
/** @var TimingsHandler */
public static $worldSave;
/** @var TimingsHandler */
public static $population;
/** @var TimingsHandler */
public static $generationCallback;
/** @var TimingsHandler */
public static $permissibleCalculation;
/** @var TimingsHandler */
public static $permissibleCalculationDiff;
/** @var TimingsHandler */
public static $permissibleCalculationCallback;
/** @var TimingsHandler */ public static TimingsHandler $schedulerSync;
public static $entityMove; public static TimingsHandler $schedulerAsync;
/** @var TimingsHandler */
public static $playerCheckNearEntities;
/** @var TimingsHandler */
public static $tickEntity;
/** @var TimingsHandler */
public static $tickTileEntity;
/** @var TimingsHandler */ public static TimingsHandler $playerCommand;
public static $entityBaseTick;
/** @var TimingsHandler */
public static $livingEntityBaseTick;
/** @var TimingsHandler */ public static TimingsHandler $craftingDataCacheRebuild;
public static $schedulerSync;
/** @var TimingsHandler */
public static $schedulerAsync;
/** @var TimingsHandler */ public static TimingsHandler $syncPlayerDataLoad;
public static $playerCommand; public static TimingsHandler $syncPlayerDataSave;
/** @var TimingsHandler */
public static $craftingDataCacheRebuild;
/** @var TimingsHandler */
public static $syncPlayerDataLoad;
/** @var TimingsHandler */
public static $syncPlayerDataSave;
/** @var TimingsHandler[] */ /** @var TimingsHandler[] */
public static $entityTypeTimingMap = []; public static array $entityTypeTimingMap = [];
/** @var TimingsHandler[] */ /** @var TimingsHandler[] */
public static $tileEntityTypeTimingMap = []; public static array $tileEntityTypeTimingMap = [];
/** @var TimingsHandler[] */ /** @var TimingsHandler[] */
public static $packetReceiveTimingMap = []; public static array $packetReceiveTimingMap = [];
/** @var TimingsHandler[] */ /** @var TimingsHandler[] */
public static $packetSendTimingMap = []; public static array $packetSendTimingMap = [];
/** @var TimingsHandler[] */ /** @var TimingsHandler[] */
public static $pluginTaskTimingMap = []; public static array $pluginTaskTimingMap = [];
/** @var TimingsHandler */ public static TimingsHandler $broadcastPackets;
public static $broadcastPackets;
public static function init() : void{ public static function init() : void{
if(self::$initialized){ if(self::$initialized){
@ -182,6 +144,7 @@ abstract class Timings{
} }
public static function getScheduledTaskTimings(TaskHandler $task, int $period) : TimingsHandler{ public static function getScheduledTaskTimings(TaskHandler $task, int $period) : TimingsHandler{
self::init();
$name = "Task: " . $task->getOwnerName() . " Runnable: " . $task->getTaskName(); $name = "Task: " . $task->getOwnerName() . " Runnable: " . $task->getTaskName();
if($period > 0){ if($period > 0){
@ -198,6 +161,7 @@ abstract class Timings{
} }
public static function getEntityTimings(Entity $entity) : TimingsHandler{ public static function getEntityTimings(Entity $entity) : TimingsHandler{
self::init();
$entityType = (new \ReflectionClass($entity))->getShortName(); $entityType = (new \ReflectionClass($entity))->getShortName();
if(!isset(self::$entityTypeTimingMap[$entityType])){ if(!isset(self::$entityTypeTimingMap[$entityType])){
if($entity instanceof Player){ if($entity instanceof Player){
@ -211,6 +175,7 @@ abstract class Timings{
} }
public static function getTileEntityTimings(Tile $tile) : TimingsHandler{ public static function getTileEntityTimings(Tile $tile) : TimingsHandler{
self::init();
$tileType = (new \ReflectionClass($tile))->getShortName(); $tileType = (new \ReflectionClass($tile))->getShortName();
if(!isset(self::$tileEntityTypeTimingMap[$tileType])){ if(!isset(self::$tileEntityTypeTimingMap[$tileType])){
self::$tileEntityTypeTimingMap[$tileType] = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "tickTileEntity - " . $tileType, self::$tickTileEntity); self::$tileEntityTypeTimingMap[$tileType] = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "tickTileEntity - " . $tileType, self::$tickTileEntity);
@ -220,6 +185,7 @@ abstract class Timings{
} }
public static function getReceiveDataPacketTimings(ServerboundPacket $pk) : TimingsHandler{ public static function getReceiveDataPacketTimings(ServerboundPacket $pk) : TimingsHandler{
self::init();
$pid = $pk->pid(); $pid = $pk->pid();
if(!isset(self::$packetReceiveTimingMap[$pid])){ if(!isset(self::$packetReceiveTimingMap[$pid])){
$pkName = (new \ReflectionClass($pk))->getShortName(); $pkName = (new \ReflectionClass($pk))->getShortName();
@ -230,6 +196,7 @@ abstract class Timings{
} }
public static function getSendDataPacketTimings(ClientboundPacket $pk) : TimingsHandler{ public static function getSendDataPacketTimings(ClientboundPacket $pk) : TimingsHandler{
self::init();
$pid = $pk->pid(); $pid = $pk->pid();
if(!isset(self::$packetSendTimingMap[$pid])){ if(!isset(self::$packetSendTimingMap[$pid])){
$pkName = (new \ReflectionClass($pk))->getShortName(); $pkName = (new \ReflectionClass($pk))->getShortName();

View File

@ -33,13 +33,9 @@ use function ucfirst;
class UpdateChecker{ class UpdateChecker{
/** @var Server */ protected Server $server;
protected $server; protected string $endpoint;
/** @var string */ protected ?UpdateInfo $updateInfo = null;
protected $endpoint;
/** @var UpdateInfo|null */
protected $updateInfo = null;
private \Logger $logger; private \Logger $logger;
public function __construct(Server $server, string $endpoint){ public function __construct(Server $server, string $endpoint){

View File

@ -89,7 +89,7 @@ class Config{
private bool $changed = false; private bool $changed = false;
/** @var int[] */ /** @var int[] */
public static $formats = [ public static array $formats = [
"properties" => Config::PROPERTIES, "properties" => Config::PROPERTIES,
"cnf" => Config::CNF, "cnf" => Config::CNF,
"conf" => Config::CNF, "conf" => Config::CNF,

View File

@ -64,10 +64,8 @@ use const SOCK_DGRAM;
use const SOL_UDP; use const SOL_UDP;
class Internet{ class Internet{
/** @var string|false */ public static string|false $ip = false;
public static $ip = false; public static bool $online = true;
/** @var bool */
public static $online = true;
/** /**
* Gets the External IP using an external service, it is cached * Gets the External IP using an external service, it is cached

View File

@ -32,8 +32,7 @@ use const PHP_EOL;
use const PTHREADS_INHERIT_NONE; use const PTHREADS_INHERIT_NONE;
class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{ class MainLogger extends \AttachableThreadedLogger implements \BufferedLogger{
/** @var bool */ protected bool $logDebug;
protected $logDebug;
private string $format = TextFormat::AQUA . "[%s] " . TextFormat::RESET . "%s[%s/%s]: %s" . TextFormat::RESET; private string $format = TextFormat::AQUA . "[%s] " . TextFormat::RESET . "%s[%s/%s]: %s" . TextFormat::RESET;
private bool $useFormattingCodes = false; private bool $useFormattingCodes = false;

View File

@ -40,8 +40,7 @@ class Random{
private int $z; private int $z;
private int $w; private int $w;
/** @var int */ protected int $seed;
protected $seed;
/** /**
* @param int $seed Integer to be used as seed. * @param int $seed Integer to be used as seed.

View File

@ -27,18 +27,11 @@ use pocketmine\thread\Thread;
use function time; use function time;
class ServerKiller extends Thread{ class ServerKiller extends Thread{
/** @var int */
public $time;
private bool $stopped = false; private bool $stopped = false;
/** public function __construct(
* @param int $time public int $time = 15
*/ ){}
public function __construct($time = 15){
$this->time = $time;
}
protected function onRun() : void{ protected function onRun() : void{
$start = time(); $start = time();

View File

@ -48,35 +48,27 @@ use function sqrt;
class Explosion{ class Explosion{
private int $rays = 16; private int $rays = 16;
/** @var World */ public World $world;
public $world;
/** @var Position */
public $source;
/** @var float */
public $size;
/** @var Block[] */ /** @var Block[] */
public $affectedBlocks = []; public array $affectedBlocks = [];
/** @var float */ public float $stepLen = 0.3;
public $stepLen = 0.3;
private Entity|Block|null $what;
private SubChunkExplorer $subChunkExplorer; private SubChunkExplorer $subChunkExplorer;
public function __construct(Position $center, float $size, Entity|Block|null $what = null){ public function __construct(
if(!$center->isValid()){ public Position $source,
public float $size,
private Entity|Block|null $what = null
){
if(!$this->source->isValid()){
throw new \InvalidArgumentException("Position does not have a valid world"); throw new \InvalidArgumentException("Position does not have a valid world");
} }
$this->source = $center; $this->world = $this->source->getWorld();
$this->world = $center->getWorld();
if($size <= 0){ if($size <= 0){
throw new \InvalidArgumentException("Explosion radius must be greater than 0, got $size"); throw new \InvalidArgumentException("Explosion radius must be greater than 0, got $size");
} }
$this->size = $size;
$this->what = $what;
$this->subChunkExplorer = new SubChunkExplorer($this->world); $this->subChunkExplorer = new SubChunkExplorer($this->world);
} }

View File

@ -32,7 +32,7 @@ use pocketmine\world\format\Chunk;
class SimpleChunkManager implements ChunkManager{ class SimpleChunkManager implements ChunkManager{
/** @var Chunk[] */ /** @var Chunk[] */
protected $chunks = []; protected array $chunks = [];
public function __construct( public function __construct(
private int $minY, private int $minY,

View File

@ -170,7 +170,7 @@ class World implements ChunkManager{
private array $entitiesByChunk = []; private array $entitiesByChunk = [];
/** @var Entity[] */ /** @var Entity[] */
public $updateEntities = []; public array $updateEntities = [];
/** @var Block[][] */ /** @var Block[][] */
private array $blockCache = []; private array $blockCache = [];
@ -202,8 +202,7 @@ class World implements ChunkManager{
private array $unloadQueue = []; private array $unloadQueue = [];
private int $time; private int $time;
/** @var bool */ public bool $stopTime = false;
public $stopTime = false;
private float $sunAnglePercentage = 0.0; private float $sunAnglePercentage = 0.0;
private int $skyLightReduction = 0; private int $skyLightReduction = 0;
@ -261,11 +260,9 @@ class World implements ChunkManager{
/** @var bool[] */ /** @var bool[] */
private array $randomTickBlocks = []; private array $randomTickBlocks = [];
/** @var WorldTimings */ public WorldTimings $timings;
public $timings;
/** @var float */ public float $tickRateTime = 0;
public $tickRateTime = 0;
private bool $doingTick = false; private bool $doingTick = false;

View File

@ -44,10 +44,8 @@ abstract class Biome{
/** @var Block[] */ /** @var Block[] */
private array $groundCover = []; private array $groundCover = [];
/** @var float */ protected float $rainfall = 0.5;
protected $rainfall = 0.5; protected float $temperature = 0.5;
/** @var float */
protected $temperature = 0.5;
public function clearPopulators() : void{ public function clearPopulators() : void{
$this->populators = []; $this->populators = [];

View File

@ -45,25 +45,21 @@ class Chunk{
private int $terrainDirtyFlags = 0; private int $terrainDirtyFlags = 0;
/** @var bool|null */ protected ?bool $lightPopulated = false;
protected $lightPopulated = false; protected bool $terrainPopulated = false;
/** @var bool */
protected $terrainPopulated = false;
/** /**
* @var \SplFixedArray|SubChunk[] * @var \SplFixedArray|SubChunk[]
* @phpstan-var \SplFixedArray<SubChunk> * @phpstan-var \SplFixedArray<SubChunk>
*/ */
protected $subChunks; protected \SplFixedArray $subChunks;
/** @var Tile[] */ /** @var Tile[] */
protected $tiles = []; protected array $tiles = [];
/** @var HeightArray */ protected HeightArray $heightMap;
protected $heightMap;
/** @var BiomeArray */ protected BiomeArray $biomeIds;
protected $biomeIds;
/** /**
* @param SubChunk[] $subChunks * @param SubChunk[] $subChunks

View File

@ -33,17 +33,15 @@ use pocketmine\world\WorldException;
use function file_exists; use function file_exists;
abstract class BaseWorldProvider implements WorldProvider{ abstract class BaseWorldProvider implements WorldProvider{
/** @var string */ protected WorldData $worldData;
protected $path;
/** @var WorldData */
protected $worldData;
public function __construct(string $path){ public function __construct(
protected string $path
){
if(!file_exists($path)){ if(!file_exists($path)){
throw new WorldException("World does not exist"); throw new WorldException("World does not exist");
} }
$this->path = $path;
$this->worldData = $this->loadLevelData(); $this->worldData = $this->loadLevelData();
} }

View File

@ -36,7 +36,7 @@ final class WorldProviderManager{
* @var WorldProviderManagerEntry[] * @var WorldProviderManagerEntry[]
* @phpstan-var array<string, WorldProviderManagerEntry> * @phpstan-var array<string, WorldProviderManagerEntry>
*/ */
protected $providers = []; protected array $providers = [];
private WritableWorldProviderManagerEntry $default; private WritableWorldProviderManagerEntry $default;

View File

@ -32,20 +32,15 @@ use pocketmine\world\format\io\WorldData;
use function file_exists; use function file_exists;
abstract class BaseNbtWorldData implements WorldData{ abstract class BaseNbtWorldData implements WorldData{
protected CompoundTag $compoundTag;
/** @var string */
protected $dataPath;
/** @var CompoundTag */
protected $compoundTag;
/** /**
* @throws CorruptedWorldException * @throws CorruptedWorldException
* @throws UnsupportedWorldFormatException * @throws UnsupportedWorldFormatException
*/ */
public function __construct(string $dataPath){ public function __construct(
$this->dataPath = $dataPath; protected string $dataPath
){
if(!file_exists($this->dataPath)){ if(!file_exists($this->dataPath)){
throw new CorruptedWorldException("World data not found at $dataPath"); throw new CorruptedWorldException("World data not found at $dataPath");
} }

View File

@ -83,8 +83,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
private const CAVES_CLIFFS_EXPERIMENTAL_SUBCHUNK_KEY_OFFSET = 4; private const CAVES_CLIFFS_EXPERIMENTAL_SUBCHUNK_KEY_OFFSET = 4;
/** @var \LevelDB */ protected \LevelDB $db;
protected $db;
private static function checkForLevelDBExtension() : void{ private static function checkForLevelDBExtension() : void{
if(!extension_loaded('leveldb')){ if(!extension_loaded('leveldb')){

View File

@ -64,24 +64,20 @@ class RegionLoader{
public const FIRST_SECTOR = 2; //location table occupies 0 and 1 public const FIRST_SECTOR = 2; //location table occupies 0 and 1
/** @var string */
protected $filePath;
/** @var resource */ /** @var resource */
protected $filePointer; protected $filePointer;
/** @var int */ protected int $nextSector = self::FIRST_SECTOR;
protected $nextSector = self::FIRST_SECTOR;
/** @var RegionLocationTableEntry[]|null[] */ /** @var RegionLocationTableEntry[]|null[] */
protected $locationTable = []; protected array $locationTable = [];
/** @var RegionGarbageMap */ protected RegionGarbageMap $garbageTable;
protected $garbageTable; public int $lastUsed;
/** @var int */
public $lastUsed = 0;
/** /**
* @throws CorruptedRegionException * @throws CorruptedRegionException
*/ */
private function __construct(string $filePath){ private function __construct(
$this->filePath = $filePath; protected string $filePath
){
$this->garbageTable = new RegionGarbageMap([]); $this->garbageTable = new RegionGarbageMap([]);
$this->lastUsed = time(); $this->lastUsed = time();

View File

@ -73,7 +73,7 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
} }
/** @var RegionLoader[] */ /** @var RegionLoader[] */
protected $regions = []; protected array $regions = [];
protected function loadLevelData() : WorldData{ protected function loadLevelData() : WorldData{
return new JavaWorldData(Path::join($this->getPath(), "level.dat")); return new JavaWorldData(Path::join($this->getPath(), "level.dat"));

Some files were not shown because too many files have changed in this diff Show More