当前位置: 首页>>代码示例>>PHP>>正文


PHP BlockPlaceEvent::getItem方法代码示例

本文整理汇总了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;
 }
开发者ID:nao20010128nao,项目名称:FiredNubesco,代码行数:29,代码来源:PluginMain.php

示例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);
     }
 }
开发者ID:TBNRFrags2468,项目名称:EssentialsPE,代码行数:16,代码来源:OtherEvents.php

示例3: onPlace

 public function onPlace(BlockPlaceEvent $ev)
 {
     $this->checkPlenty($ev->getPlayer(), $ev->getItem());
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:4,代码来源:CmdPlenty.php

示例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();
     }
 }
开发者ID:HelloWorld017,项目名称:ToAruPG,代码行数:10,代码来源:ToAruPG.php


注:本文中的pocketmine\event\block\BlockPlaceEvent::getItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。