本文整理汇总了PHP中pocketmine\event\block\BlockPlaceEvent::getItem方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockPlaceEvent::getItem方法的具体用法?PHP BlockPlaceEvent::getItem怎么用?PHP BlockPlaceEvent::getItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\block\BlockPlaceEvent
的用法示例。
在下文中一共展示了BlockPlaceEvent::getItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blockPlace
public function blockPlace(BlockPlaceEvent $event)
{
//2
$id = $event->getItem()->getId();
if ($id == $this->id) {
$player = $event->getPlayer();
$username = $player->getName();
if (empty($this->data[$user][2])) {
$x = $event->getBlock()->x;
$y = $event->getBlock()->y;
$z = $event->getBlock()->z;
$this->data[$user][2] = array($x, $y, $z);
$ms = "";
if (isset($this->data[$user][2])) {
//片方がセットされていたら
$ms = "[FiredNubesco] Second position has been set to: {$x}, {$y}, {$z}";
$size = $this->countBlocks($player);
if ($num != false) {
$ms .= " (Size: " . $size[0] . "X" . $size[1] . ")";
}
} else {
$ms = "[FiredNubesco] First position has been set to: {$x}, {$y}, {$z}";
}
$player->sendMessage($ms);
$event->setCancelled(true);
}
}
return true;
}
示例2: onBlockPlace
/**
* @param BlockPlaceEvent $event
*
* @priority HIGH
*/
public function onBlockPlace(BlockPlaceEvent $event)
{
// PowerTool
if ($this->getAPI()->executePowerTool($event->getPlayer(), $event->getItem())) {
$event->setCancelled(true);
} elseif ($this->getAPI()->isUnlimitedEnabled($event->getPlayer())) {
$event->setCancelled(true);
$pos = new Vector3($event->getBlockReplaced()->getX(), $event->getBlockReplaced()->getY(), $event->getBlockReplaced()->getZ());
$event->getPlayer()->getLevel()->setBlock($pos, $event->getBlock(), true);
}
}
示例3: onPlace
public function onPlace(BlockPlaceEvent $ev)
{
$this->checkPlenty($ev->getPlayer(), $ev->getItem());
}
示例4: onBlockPlace
public function onBlockPlace(BlockPlaceEvent $event)
{
if (!$this->isValidPlayer($event->getPlayer())) {
return;
}
$rpg = $this->players[$event->getPlayer()->getName()];
if ($rpg->getSkillByItem($event->getItem()) !== null) {
$event->setCancelled();
}
}