本文整理汇总了PHP中pocketmine\Player::getWindowId方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::getWindowId方法的具体用法?PHP Player::getWindowId怎么用?PHP Player::getWindowId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::getWindowId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onClose
public function onClose(Player $who)
{
$pk = new ContainerClosePacket();
$pk->windowid = $who->getWindowId($this);
$who->dataPacket($pk);
parent::onClose($who);
}
示例2: onClose
public function onClose(Player $who)
{
$pk = new ContainerClosePacket();
$pk->windowid = $who->getWindowId($this);
$who->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
parent::onClose($who);
}
示例3: fillUpChest
public static function fillUpChest(Block $chest, Player $player)
{
if ($chest->getId() == Item::CHEST || $chest->getId()) {
if ($player->gamemode == Player::CREATIVE) {
$player->sendMessage("[HG] You are in creative Mode");
return;
}
if (!$player->isOp()) {
$pk = new ContainerSetContentPacket();
$pk->windowid = $player->getWindowId($player->getInventory());
// ContainerSetContentPacket::SPECIAL_INVENTORY;
for ($i = 1; $i < 5; $i++) {
$pk->slots[] = HungerGameKit::randomItems();
}
$player->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
if ($player->getInventory() != null) {
$player->getInventory()->sendContents($player);
}
// $player->sendMessage ( "[HG] openning chest" );
}
}
}
示例4: openChest
public static function openChest(Block $chest, Player $player)
{
if ($chest->getId() == Item::CHEST) {
if ($player->gamemode == Player::CREATIVE) {
$player->sendMessage("[HG] You are in creative Mode");
return;
}
if (!$player->isOp()) {
$pk = new ContainerOpenPacket();
$pk->windowid = $player->getWindowId($player->getInventory());
$pk->type = InventoryType::CHEST;
$pk->slots = $player->getInventory()->getSize();
$pk->x = $chest->x;
$pk->y = $chest->y;
$pk->z = $chest->z;
$player->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
$player->getInventory()->sendContents($player);
}
}
}