box up TakeItemActorPacket sending behind NetworkSession API

we need to start thinking about moving this into interfaces.
This commit is contained in:
Dylan K. Taylor
2020-04-29 16:24:04 +01:00
parent 1122f2a29f
commit d8968e9e40
3 changed files with 12 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ namespace pocketmine\network\mcpe;
use Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
use pocketmine\entity\Attribute;
use pocketmine\entity\effect\EffectInstance;
use pocketmine\entity\Entity;
use pocketmine\entity\Human;
use pocketmine\entity\Living;
use pocketmine\event\player\PlayerCreationEvent;
@@ -72,6 +73,7 @@ use pocketmine\network\mcpe\protocol\ServerToClientHandshakePacket;
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
use pocketmine\network\mcpe\protocol\SetSpawnPositionPacket;
use pocketmine\network\mcpe\protocol\SetTitlePacket;
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
use pocketmine\network\mcpe\protocol\TextPacket;
use pocketmine\network\mcpe\protocol\TransferPacket;
use pocketmine\network\mcpe\protocol\types\command\CommandData;
@@ -829,6 +831,10 @@ class NetworkSession{
));
}
public function onPlayerPickUpItem(Player $collector, Entity $pickedUp) : void{
$this->sendDataPacket(TakeItemActorPacket::create($collector->getId(), $pickedUp->getId()));
}
public function syncPlayerList() : 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());