mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Modernize private property declarations in src/player
This commit is contained in:
parent
22edca610c
commit
7bc3dcdefd
@ -69,18 +69,16 @@ final class GameMode{
|
||||
return self::$aliasMap[mb_strtolower($str)] ?? null;
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
private $englishName;
|
||||
/** @var string[] */
|
||||
private $aliases;
|
||||
|
||||
/**
|
||||
* @param string[] $aliases
|
||||
*/
|
||||
private function __construct(string $enumName, string $englishName, private Translatable $translatableName, array $aliases = []){
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $englishName,
|
||||
private Translatable $translatableName,
|
||||
private array $aliases = []
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
$this->englishName = $englishName;
|
||||
$this->aliases = $aliases;
|
||||
}
|
||||
|
||||
public function getEnglishName() : string{
|
||||
|
@ -27,16 +27,10 @@ use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\LongTag;
|
||||
|
||||
class OfflinePlayer implements IPlayer{
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
/** @var CompoundTag|null */
|
||||
private $namedtag;
|
||||
|
||||
public function __construct(string $name, ?CompoundTag $namedtag){
|
||||
$this->name = $name;
|
||||
$this->namedtag = $namedtag;
|
||||
}
|
||||
public function __construct(
|
||||
private string $name,
|
||||
private ?CompoundTag $namedtag
|
||||
){}
|
||||
|
||||
public function getName() : string{
|
||||
return $this->name;
|
||||
|
@ -27,13 +27,7 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\world\TickingChunkLoader;
|
||||
|
||||
final class PlayerChunkLoader implements TickingChunkLoader{
|
||||
|
||||
/** @var Vector3 */
|
||||
private $currentLocation;
|
||||
|
||||
public function __construct(Vector3 $currentLocation){
|
||||
$this->currentLocation = $currentLocation;
|
||||
}
|
||||
public function __construct(private Vector3 $currentLocation){}
|
||||
|
||||
public function setCurrentLocation(Vector3 $currentLocation) : void{
|
||||
$this->currentLocation = $currentLocation;
|
||||
|
@ -31,31 +31,18 @@ use Ramsey\Uuid\UuidInterface;
|
||||
* Encapsulates data needed to create a player.
|
||||
*/
|
||||
class PlayerInfo{
|
||||
|
||||
/** @var string */
|
||||
private $username;
|
||||
/** @var UuidInterface */
|
||||
private $uuid;
|
||||
/** @var Skin */
|
||||
private $skin;
|
||||
/** @var string */
|
||||
private $locale;
|
||||
/**
|
||||
* @var mixed[]
|
||||
* @phpstan-var array<string, mixed>
|
||||
*/
|
||||
private $extraData;
|
||||
|
||||
/**
|
||||
* @param mixed[] $extraData
|
||||
* @phpstan-param array<string, mixed> $extraData
|
||||
*/
|
||||
public function __construct(string $username, UuidInterface $uuid, Skin $skin, string $locale, array $extraData = []){
|
||||
public function __construct(
|
||||
private string $username,
|
||||
private UuidInterface $uuid,
|
||||
private Skin $skin,
|
||||
private string $locale,
|
||||
private array $extraData = []
|
||||
){
|
||||
$this->username = TextFormat::clean($username);
|
||||
$this->uuid = $uuid;
|
||||
$this->skin = $skin;
|
||||
$this->locale = $locale;
|
||||
$this->extraData = $extraData;
|
||||
}
|
||||
|
||||
public function getUsername() : string{
|
||||
|
@ -37,36 +37,18 @@ final class SurvivalBlockBreakHandler{
|
||||
|
||||
public const DEFAULT_FX_INTERVAL_TICKS = 5;
|
||||
|
||||
/** @var Player */
|
||||
private $player;
|
||||
/** @var Vector3 */
|
||||
private $blockPos;
|
||||
/** @var Block */
|
||||
private $block;
|
||||
/** @var int */
|
||||
private $targetedFace;
|
||||
|
||||
/** @var int */
|
||||
private $fxTicker = 0;
|
||||
/** @var int */
|
||||
private $fxTickInterval;
|
||||
/** @var int */
|
||||
private $maxPlayerDistance;
|
||||
|
||||
/** @var float */
|
||||
private $breakSpeed;
|
||||
|
||||
/** @var float */
|
||||
private $breakProgress = 0;
|
||||
|
||||
public function __construct(Player $player, Vector3 $blockPos, Block $block, int $targetedFace, int $maxPlayerDistance, int $fxTickInterval = self::DEFAULT_FX_INTERVAL_TICKS){
|
||||
$this->player = $player;
|
||||
$this->blockPos = $blockPos;
|
||||
$this->block = $block;
|
||||
$this->targetedFace = $targetedFace;
|
||||
$this->fxTickInterval = $fxTickInterval;
|
||||
$this->maxPlayerDistance = $maxPlayerDistance;
|
||||
private int $fxTicker = 0;
|
||||
private float $breakSpeed;
|
||||
private float $breakProgress = 0;
|
||||
|
||||
public function __construct(
|
||||
private Player $player,
|
||||
private Vector3 $blockPos,
|
||||
private Block $block,
|
||||
private int $targetedFace,
|
||||
private int $maxPlayerDistance,
|
||||
private int $fxTickInterval = self::DEFAULT_FX_INTERVAL_TICKS
|
||||
){
|
||||
$this->breakSpeed = $this->calculateBreakProgressPerTick();
|
||||
if($this->breakSpeed > 0){
|
||||
$this->player->getWorld()->broadcastPacketToViewers(
|
||||
|
@ -30,9 +30,7 @@ use Ramsey\Uuid\UuidInterface;
|
||||
* Encapsulates player info specific to players who are authenticated with XBOX Live.
|
||||
*/
|
||||
final class XboxLivePlayerInfo extends PlayerInfo{
|
||||
|
||||
/** @var string */
|
||||
private $xuid;
|
||||
private string $xuid;
|
||||
|
||||
public function __construct(string $xuid, string $username, UuidInterface $uuid, Skin $skin, string $locale, array $extraData = []){
|
||||
parent::__construct($username, $uuid, $skin, $locale, $extraData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user