当前位置: 首页>>代码示例>>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;未经允许,请勿转载。