NetworkSession: allow provision of a custom list of players to syncPlayerList()

This commit is contained in:
Dylan K. Taylor
2020-04-29 16:27:34 +01:00
parent d8968e9e40
commit ad70a9e3dc
2 changed files with 6 additions and 3 deletions

View File

@@ -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{