當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PlayerMoveEvent::isCancelled方法代碼示例

本文整理匯總了PHP中pocketmine\event\player\PlayerMoveEvent::isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:PHP PlayerMoveEvent::isCancelled方法的具體用法?PHP PlayerMoveEvent::isCancelled怎麽用?PHP PlayerMoveEvent::isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\event\player\PlayerMoveEvent的用法示例。


在下文中一共展示了PlayerMoveEvent::isCancelled方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onPlayerMove

 /** 
  * @param PlayerMoveEvent $event 
  */
 public function onPlayerMove(PlayerMoveEvent $event)
 {
     if (!$event->isCancelled()) {
         if ($this->getPlugin()->isRocketPad($event->getPlayer()->getLevel()->getBlock($event->getPlayer()->subtract(0, 1, 0)))) {
             $this->getPlugin()->launchPlayer($event->getPlayer());
         }
     }
 }
開發者ID:Evarettedavis,項目名稱:PocketMine-Plugins,代碼行數:11,代碼來源:RocketPadsListener.php

示例2: onMove

 public function onMove(PlayerMoveEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     if ($this->checkMove($ev->getTo())) {
         $ev->setCancelled();
     }
     return;
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:10,代碼來源:Main.php

示例3: onMove

 /**
  * @priority HIGHEST
  */
 public function onMove(PlayerMoveEvent $e)
 {
     if ($e->isCancelled()) {
         return;
     }
     $pl = $e->getPlayer();
     if (!$this->owner->getState("Torch", $pl, null)) {
         return;
     }
     $this->spawnTorch($pl);
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:14,代碼來源:TorchMgr.php

示例4: onMove

 public function onMove(PlayerMoveEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $from = $ev->getFrom();
     $to = $ev->getTo();
     $dir = ["dx" => $to->getX() - $from->getX(), "dy" => $to->getY() - $from->getY(), "dz" => $to->getZ() - $from->getZ()];
     if (!$dir["dy"]) {
         return;
     }
     $id = $to->getLevel()->getBlockIdAt($to->getX(), $to->getY() - 1, $to->getZ());
     if (isset($this->blocks[$id])) {
         $ev->getPlayer()->setMotion(new Vector3($dir["dx"], -$dir["dy"] * 1.1, $dir["dz"]));
     }
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:16,代碼來源:Trampoline.php

示例5: onMove

 /**
  * Handle player move events.
  * @param PlayerMoveEvent $ev - Move event
  */
 public function onMove(PlayerMoveEvent $ev)
 {
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     if ($ev->isCancelled()) {
         return;
     }
     $p = $ev->getPlayer();
     if (!$this->getState("fz", $p, false)) {
         return;
     }
     if ($this->hard) {
         $ev->setCancelled();
     } else {
         // Lock position but still allow to turn around
         $to = clone $ev->getFrom();
         $to->yaw = $ev->getTo()->yaw;
         $to->pitch = $ev->getTo()->pitch;
         $ev->setTo($to);
     }
 }
開發者ID:HeechFive,項目名稱:pocketmine-plugins,代碼行數:24,代碼來源:FreezeSession.php

示例6: onPlayerMove

 public function onPlayerMove(PlayerMoveEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $pl = $ev->getPlayer();
     $pos = $ev->getTo();
     if ($this->checkMove($pl->getLevel()->getName(), $pos->getX(), $pos->getZ())) {
         return;
     }
     $this->owner->msg($pl, mc::_("You have reached the end of the world"));
     $ev->setCancelled();
 }
開發者ID:Gabriel865,項目名稱:pocketmine-plugins,代碼行數:13,代碼來源:WpBordersMgr.php

示例7: onMove

 public function onMove(PlayerMoveEvent $ev)
 {
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     if ($ev->isCancelled()) {
         return;
     }
     $p = $ev->getPlayer();
     if (isset($this->frosties[strtolower($p->getName())])) {
         if ($this->hard) {
             $ev->setCancelled();
             if (MPMU::apiVersion("1.12.0")) {
                 $p->sendTip(mc::_("You are frozen"));
             }
         } else {
             // Lock position but still allow to turn around
             $to = clone $ev->getFrom();
             $to->yaw = $ev->getTo()->yaw;
             $to->pitch = $ev->getTo()->pitch;
             $ev->setTo($to);
             if (MPMU::apiVersion("1.12.0")) {
                 $p->sendTip(mc::_("You are frozen in place"));
             }
         }
     }
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:25,代碼來源:CmdFreezeMgr.php

示例8: onMove

 public function onMove(PlayerMoveEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $pl = $ev->getPlayer();
     $l = $pl->getLevel();
     $world = $l->getName();
     if (!isset($this->portals[$world])) {
         return;
     }
     $x = $ev->getTo()->getX();
     $y = $ev->getTo()->getY();
     $z = $ev->getTo()->getZ();
     foreach ($this->portals[$world] as $p) {
         list($bb1, $bb2, $target) = $p;
         if ($bb1[0] <= $x && $bb1[1] <= $y && $bb1[2] <= $z && $x <= $bb1[3] && $y <= $bb1[4] && $z <= $bb1[5]) {
             $dest = $this->checkTarget($target);
             if (!$dest) {
                 $pl->sendMessage(mc::_("Nothing happens!"));
                 return;
             }
             $n = strtolower($pl->getName());
             $now = time();
             if (isset($this->tweak[$n])) {
                 // Already in here...
                 if ($this->tweak[$n][0] > $now) {
                     return;
                 }
             }
             $this->tweak[$n] = [$now + 3, $dest];
             $this->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [$this, "portalActiveSg1"], [$n]), 1);
             return;
         }
     }
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:36,代碼來源:Main.php


注:本文中的pocketmine\event\player\PlayerMoveEvent::isCancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。