sendArmorContents() public method

public sendArmorContents ( Player | Player[] $target )
$target pocketmine\Player | pocketmine\Player[]
示例#1
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])) {
         $this->hasSpawned[$player->getLoaderId()] = $player;
         if (strlen($this->skin) < 64 * 32 * 4) {
             $this->close();
             throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
         }
         if (!$this instanceof Player) {
             $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->skinId, $this->skin, [$player]);
         }
         $pk = new AddPlayerPacket();
         $pk->uuid = $this->getUniqueId();
         $pk->username = $this->getName();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->speedX = $this->motionX;
         $pk->speedY = $this->motionY;
         $pk->speedZ = $this->motionZ;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->item = $this->getInventory()->getItemInHand();
         $pk->metadata = $this->dataProperties;
         $player->dataPacket($pk);
         $this->inventory->sendArmorContents($player);
         if (!$this instanceof Player) {
             $this->server->removePlayerListData($this->getUniqueId(), [$player]);
         }
     }
 }
示例#2
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getID()])) {
         $this->hasSpawned[$player->getID()] = $player;
         $pk = new AddPlayerPacket();
         $pk->clientID = 0;
         if ($player->getRemoveFormat()) {
             $pk->username = TextFormat::clean($this->nameTag);
         } else {
             $pk->username = $this->nameTag;
         }
         $pk->eid = $this->getID();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->unknown1 = 0;
         $pk->unknown2 = 0;
         $pk->metadata = $this->getData();
         $player->dataPacket($pk);
         $pk = new SetEntityMotionPacket();
         $pk->entities = [[$this->getID(), $this->motionX, $this->motionY, $this->motionZ]];
         $player->dataPacket($pk);
         $this->inventory->sendHeldItem($player);
         $this->inventory->sendArmorContents($player);
     }
 }
示例#3
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) {
         $this->hasSpawned[$player->getId()] = $player;
         if (\strlen($this->skin) < 64 * 32 * 4) {
             throw new \InvalidStateException((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
         }
         $pk = new AddPlayerPacket();
         $pk->clientID = $this->getId();
         $pk->username = $this->getName();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->speedX = $this->motionX;
         $pk->speedY = $this->motionY;
         $pk->speedZ = $this->motionZ;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item->getId();
         $pk->meta = $item->getDamage();
         $pk->skin = $this->skin;
         $pk->slim = $this->isSlim;
         $pk->metadata = $this->dataProperties;
         $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
         $this->inventory->sendArmorContents($player);
     }
 }
示例#4
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) {
         $this->hasSpawned[$player->getId()] = $player;
         //			if(strlen($this->skin) < 64 * 32 * 4){
         //				$this->server->getLogger()->info((new \ReflectionClass($this))->getShortName() . " must have a valid skin set");
         //			}
         if (!$this instanceof Player) {
             $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin, [$player]);
         }
         $pk = new PlayerListPacket();
         $pk->type = PlayerListPacket::TYPE_ADD;
         $pk->entries[] = [$this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin];
         $player->dataPacket($pk);
         $pk = new AddPlayerPacket();
         $pk->uuid = $this->getUniqueId();
         $pk->username = $this->getName();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->speedX = $this->motionX;
         $pk->speedY = $this->motionY;
         $pk->speedZ = $this->motionZ;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->item = $this->getInventory()->getItemInHand();
         $pk->metadata = $this->dataProperties;
         $player->dataPacket($pk);
         $this->inventory->sendArmorContents($player);
         if (!$this instanceof Player) {
             $this->server->removePlayerListData($this->getUniqueId(), [$player]);
         }
     }
 }
示例#5
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) {
         $this->hasSpawned[$player->getId()] = $player;
         $pk = new AddPlayerPacket();
         $pk->clientID = 0;
         if ($player->getRemoveFormat()) {
             $pk->username = TextFormat::clean($this->nameTag);
         } else {
             $pk->username = $this->nameTag;
         }
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item->getId();
         $pk->meta = $item->getDamage();
         $pk->metadata = $this->getData();
         $player->dataPacket($pk);
         $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
         $this->inventory->sendArmorContents($player);
     }
 }
示例#6
0
 public function equip(PlayerInventory $inv, PvpSessionData $data, $send = true)
 {
     $inv->clearAll();
     $messages = [];
     $info = Settings::kitpvp_getKitUpgradeInfo("helmet", $this->helmet);
     $inv->setHelmet($info->getItem());
     $messages[] = $info->itemsToString();
     $info = Settings::kitpvp_getKitUpgradeInfo("chestplate", $this->chestplate);
     $inv->setChestplate($info->getItem());
     $messages[] = $info->itemsToString();
     $info = Settings::kitpvp_getKitUpgradeInfo("leggings", $this->leggings);
     $inv->setLeggings($info->getItem());
     $messages[] = $info->itemsToString();
     $info = Settings::kitpvp_getKitUpgradeInfo("boots", $this->boots);
     $inv->setBoots($info->getItem());
     $messages[] = $info->itemsToString();
     $inv->sendArmorContents($inv->getViewers());
     if ($data->isUsingBowKit()) {
         $weapon = $data->getBowLevel() > 0 ? new Bow() : Item::get(Item::AIR);
         $messages[] = "a bow";
     } else {
         $info = Settings::kitpvp_getKitUpgradeInfo("weapon", $this->weapon);
         $weapon = $info->getItem();
         $messages[] = $info->itemsToString();
     }
     $info = Settings::kitpvp_getKitUpgradeInfo("food", $this->food);
     $food = $info->getItem();
     $messages[] = $info->itemsToString();
     $info = Settings::kitpvp_getKitUpgradeInfo("arrows", $this->arrows);
     $arrows = $info->getItem();
     $messages[] = $info->itemsToString();
     /** @var \pocketmine\item\Item[] $items */
     $items = [];
     if ($weapon->getId() !== Item::AIR) {
         $items[] = $weapon;
     }
     if ($food->getId() !== 0) {
         $items[] = $food;
     }
     if ($arrows->getId() !== 0) {
         $items[] = $arrows;
     }
     $inv->addItem(...$items);
     $cnt = Settings::easter_getSnowballCount($data->getSession());
     if ($cnt > 0) {
         $inv->addItem(new Snowball(0, $cnt));
     }
     if ($data->getKills() <= 500) {
         $inv->addItem(new Snowball(0, 8));
     }
     if ($send) {
         $inv->sendHeldItem($inv->getViewers());
         $inv->sendArmorContents($inv->getViewers());
     }
 }