mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-15 16:05:28 +00:00
Accept null for targets in Human->sendSkin()
For humans, it'll send to all viewers. For players, it'll send to all viewers, and the player itself.
This commit is contained in:
parent
f79e4237df
commit
600d80331a
@ -762,6 +762,20 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return true;
|
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
|
* Gets the player IP address
|
||||||
*
|
*
|
||||||
|
@ -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 = new PlayerSkinPacket();
|
||||||
$pk->uuid = $this->getUniqueId();
|
$pk->uuid = $this->getUniqueId();
|
||||||
$pk->skin = $this->skin;
|
$pk->skin = $this->skin;
|
||||||
$this->server->broadcastPacket($targets, $pk);
|
$this->server->broadcastPacket($targets ?? $this->hasSpawned, $pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jump(){
|
public function jump(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user