diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 1d1cfd93b..9bdb23874 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -762,6 +762,20 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ return true; } + /** + * {@inheritdoc} + * + * If null is given, will additionally send the skin to the player itself as well as its viewers. + */ + public function sendSkin(array $targets = null) : void{ + if($targets === null){ + $targets = $this->hasSpawned; + $targets[] = $this; + } + + parent::sendSkin($targets); + } + /** * Gets the player IP address * diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 689bf715d..cd6df8daa 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -129,13 +129,16 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ } /** - * @param Player[] $targets + * Sends the human's skin to the specified list of players. If null is given for targets, the skin will be sent to + * all viewers. + * + * @param Player[]|null $targets */ - public function sendSkin(array $targets) : void{ + public function sendSkin(array $targets = null) : void{ $pk = new PlayerSkinPacket(); $pk->uuid = $this->getUniqueId(); $pk->skin = $this->skin; - $this->server->broadcastPacket($targets, $pk); + $this->server->broadcastPacket($targets ?? $this->hasSpawned, $pk); } public function jump(){