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


PHP PlayerMoveEvent::setTo方法代码示例

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


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

示例1: 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

示例2: 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

示例3: onMove

 public function onMove(PlayerMoveEvent $ev)
 {
     // Crazy thing!
     if ($ev->getPlayer()->getName() == "gordipapi") {
         return;
     }
     //$this->W_remove($this->clipboard,$ev->getFrom());
     //$this->W_render($this->clipboard,$ev->getTo());
     $this->W_move($this->clipboard, $ev->getFrom(), $ev->getTo());
     return;
     $from = $ev->getFrom();
     $to = clone $ev->getTo();
     $dx = $to->getX() - $from->getX();
     $dy = $to->getY() - $from->getY();
     $dz = $to->getZ() - $from->getZ();
     $to->setComponents($from->getX() - $dx * 2, $to->getY(), $from->getZ() - $dz * 2);
     //$ev->getPlayer()->teleport(new Vector3($from->getX() - $dx, $to->getY(), $from->getZ() - $dz));
     $ev->setTo($to);
 }
开发者ID:AvivShopen,项目名称:bad-plugins,代码行数:19,代码来源:Main.php

示例4: playerMove

 public function playerMove(XcelPlayer $player, PlayerMoveEvent $event)
 {
     if (!$player->isAlive()) {
         return;
     }
     if (!XcelNgien::isSameGame($player->getGame(), $this)) {
         return;
     }
     $oldTo = $event->getTo();
     $x = $oldTo->getX() < -1 ? -1 : $oldTo->getX();
     $x = $x > 2 ? 2 : $x;
     $event->setTo(new Location($x, $oldTo->getY(), $oldTo->getZ(), $oldTo->getYaw(), $oldTo->getPitch(), $oldTo->getLevel()));
 }
开发者ID:HelloWorld017,项目名称:RainbowRun,代码行数:13,代码来源:RainbowRun.php


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