當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。