mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
NetworkSession: allow provision of a custom list of players to syncPlayerList()
This commit is contained in:
parent
d8968e9e40
commit
ad70a9e3dc
@ -835,10 +835,13 @@ class NetworkSession{
|
||||
$this->sendDataPacket(TakeItemActorPacket::create($collector->getId(), $pickedUp->getId()));
|
||||
}
|
||||
|
||||
public function syncPlayerList() : void{
|
||||
/**
|
||||
* @param Player[] $players
|
||||
*/
|
||||
public function syncPlayerList(array $players) : void{
|
||||
$this->sendDataPacket(PlayerListPacket::add(array_map(function(Player $player) : PlayerListEntry{
|
||||
return PlayerListEntry::createAdditionEntry($player->getUniqueId(), $player->getId(), $player->getDisplayName(), SkinAdapterSingleton::get()->toSkinData($player->getSkin()), $player->getXuid());
|
||||
}, $this->server->getOnlinePlayers())));
|
||||
}, $players)));
|
||||
}
|
||||
|
||||
public function onPlayerAdded(Player $p) : void{
|
||||
|
@ -99,7 +99,7 @@ class PreSpawnPacketHandler extends PacketHandler{
|
||||
$this->session->getInvManager()->syncSelectedHotbarSlot();
|
||||
$this->session->queueCompressed($this->server->getCraftingManager()->getCraftingDataPacket($this->session->getCompressor()));
|
||||
|
||||
$this->session->syncPlayerList();
|
||||
$this->session->syncPlayerList($this->server->getOnlinePlayers());
|
||||
}
|
||||
|
||||
public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user