mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 00:39:45 +00:00
PlayerSkinPacket: added ::create()
This commit is contained in:
parent
b22cc4875e
commit
600ef033ab
@ -138,10 +138,9 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
|
||||
* @param Player[]|null $targets
|
||||
*/
|
||||
public function sendSkin(?array $targets = null) : void{
|
||||
$pk = new PlayerSkinPacket();
|
||||
$pk->uuid = $this->getUniqueId();
|
||||
$pk->skin = SkinAdapterSingleton::get()->toSkinData($this->skin);
|
||||
$this->server->broadcastPackets($targets ?? $this->hasSpawned, [$pk]);
|
||||
$this->server->broadcastPackets($targets ?? $this->hasSpawned, [
|
||||
PlayerSkinPacket::create($this->getUniqueId(), SkinAdapterSingleton::get()->toSkinData($this->skin))
|
||||
]);
|
||||
}
|
||||
|
||||
public function jump() : void{
|
||||
|
@ -41,6 +41,13 @@ class PlayerSkinPacket extends DataPacket implements ClientboundPacket, Serverbo
|
||||
/** @var SkinData */
|
||||
public $skin;
|
||||
|
||||
public static function create(UUID $uuid, SkinData $skinData) : self{
|
||||
$result = new self;
|
||||
$result->uuid = $uuid;
|
||||
$result->skin = $skinData;
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function decodePayload(PacketSerializer $in) : void{
|
||||
$this->uuid = $in->getUUID();
|
||||
$this->skin = $in->getSkin();
|
||||
|
Loading…
x
Reference in New Issue
Block a user