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


PHP ProjectileLaunchEvent::getEntity方法代码示例

本文整理汇总了PHP中pocketmine\event\entity\ProjectileLaunchEvent::getEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectileLaunchEvent::getEntity方法的具体用法?PHP ProjectileLaunchEvent::getEntity怎么用?PHP ProjectileLaunchEvent::getEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\entity\ProjectileLaunchEvent的用法示例。


在下文中一共展示了ProjectileLaunchEvent::getEntity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onProjectileLaunch

 public function onProjectileLaunch(ProjectileLaunchEvent $event)
 {
     try {
         $player = $event->getEntity()->shootingEntity;
         if ($player instanceof Player and $event->getEntity() instanceof Arrow) {
             if ($event->getEntity() instanceof Arrow) {
                 foreach ($this->plugin->gameLevelManager->levels as &$lv) {
                     if ($lv instanceof GameLevelModel) {
                         if (count($lv->joinedPlayers) === 0) {
                             continue;
                         }
                         if (isset($lv->currentMap)) {
                             if (isset($lv->currentMap->playerscores[$player->getName()])) {
                                 $lv->currentMap->shooters[$event->getEntity()->getId()] = $player->getName();
                                 $scores = $lv->currentMap->playerscores[$player->getName()];
                                 $scores["shots"] = $scores["shots"] + 1;
                                 $lv->currentMap->playerscores[$player->getName()] = $scores;
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     } catch (\Exception $e) {
         $this->plugin->printError($e);
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:28,代码来源:ScoreListener.php

示例2: burstMode

 public function burstMode(ProjectileLaunchEvent $event)
 {
     $entity = $event->getEntity();
     $player = $event->getEntity()->shootingEntity;
     if (!$player instanceof Player) {
         return;
     }
     if ($player->closed) {
         return;
     }
     if ($entity instanceof Snowball) {
         $this->getServer()->getScheduler()->scheduleDelayedTask(new BurstSnowballTask($this, $player), 10);
         $this->getServer()->getScheduler()->scheduleDelayedTask(new BurstSnowballTask($this, $player), 20);
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:15,代码来源:burstMode.php

示例3: burstMode

 public function burstMode(ProjectileLaunchEvent $event)
 {
     $entity = $event->getEntity();
     $player = $event->getEntity()->shootingEntity;
     if ($player == null) {
         return;
     }
     if ($entity instanceof Snowball) {
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstSnowball"], [$player]), 10);
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstSnowball"], [$player]), 20);
     }
     if ($entity instanceof Arrow) {
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstArrow"], [$player]), 10);
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "burstArrow"], [$player]), 20);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:16,代码来源:burstMode.php

示例4: checkArrow

 public function checkArrow(ProjectileLaunchEvent $event)
 {
     if ($event->getEntity() instanceof Arrow) {
         $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "removeArrow"], [$event]), 20);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:6,代码来源:HungerGames.php

示例5: onLaunch

 public function onLaunch(ProjectileLaunchEvent $event)
 {
     $shooter = $event->getEntity()->shootingEntity;
     if ($shooter instanceof Player) {
         if ($this->checkSpawn($shooter, 5)) {
             $this->message($shooter, $this->get("cannot-spawn-pvp"));
             $event->setCancelled();
         }
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:10,代码来源:GoodSPAWN.php

示例6: checkArrow

 public function checkArrow(ProjectileLaunchEvent $event)
 {
     if ($event->getEntity() instanceof Arrow) {
         $this->getServer()->getScheduler()->scheduleDelayedTask(new removeArrowTask($event, $this->getServer()), 20);
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:6,代码来源:HungerGames.php


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