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