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


PHP CommandSender::setRotation方法代码示例

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


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

示例1: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $this->getLogger()->info("test");
     if ($command->getName() == "pk") {
         if ($args[0] == "join") {
             if (isset($args[1])) {
                 if (isset($this->arenas[strtolower($args[1])]) and substr(strtolower($args[1]), -5) != "_race") {
                     if (!isset($this->activeplayers[$sender->getName()])) {
                         $this->activeplayers[$sender->getName()] = array("current-map" => strtolower($args[1]), "last-set" => 0, "micro-seconds" => 0, "active" => false, "current-checkpoint" => 0);
                         $sender->teleport($this->arenas[strtolower($args[1])]->getStartPosition());
                         $sender->setRotation($this->arenas[strtolower($args[1])]->getStartYaw(), $sender->getPitch());
                         $sender->sendMessage("§cYou have started the map '§b" . $this->arenas[strtolower($args[1])]->getMapName() . "§c'.");
                     } else {
                         $sender->sendMessage("§cYou are currently still playing a different map\n§cUse §b/pk leave§c to leave this map.");
                     }
                 } else {
                     $sender->sendMessage("§cThe map '§b" . strtolower($args[1]) . "§c' doesn't exist.");
                 }
             } else {
                 $sender->sendMessage("§cUsage: §b/pk join [map name]");
             }
         } else {
             if ($args[0] == "leave") {
                 if (isset($this->activeplayers[$sender->getName()])) {
                     unset($this->activeplayers[$sender->getName()]);
                     $sender->sendMessage("§cYou have left your current map.");
                 } else {
                     $sender->sendMessage("§cYou aren't currently playing any maps.");
                 }
             } else {
                 if ($args[0] == "info") {
                     if (isset($args[1])) {
                         if (isset($this->arenas[strtolower($args[1])])) {
                             $map = $this->arenas[strtolower($args[1])];
                             $currentlyplaying = array();
                             foreach ($this->activeplayers as $player => $name) {
                                 if ($name['current-map'] == strtolower($args[1])) {
                                     array_push($currentlyplaying, $player);
                                 }
                             }
                             $sender->sendMessage("§cMap info:\n§cMap name: §b" . $map->getMapName() . "\n§cMap maker: §b" . $map->getMapMaker() . "\n§cDate of creation: §b" . $map->getDateOfCreation() . "\n§cMap world name: §b" . $map->getMapLevel()->getName() . "\n§cYour current highscore: §b" . ($map->getTime($sender) === null ? "none" : $map->getTime($sender)) . "\n§cCurrently playing: §b" . implode(", ", $currentlyplaying) . "\n§cFor leaderboards, please type §b/pk topten " . strtolower($args[1]));
                         } else {
                             $sender->sendMessage("§cThis map doesn't exist.");
                         }
                     } else {
                         $sender->sendMessage("§cUsage: §b/pk info [map name]");
                     }
                 } else {
                     if ($args[0] == "topten") {
                         if (isset($args[1])) {
                             if (isset($this->arenas[strtolower($args[1])])) {
                                 $sender->sendMessage("§cTop ten laps of the map §b" . $this->arenas[strtolower($args[1])]->getMapName() . "§c:");
                                 $count = 0;
                                 foreach ($this->arenas[strtolower($args[1])]->getTopTen() as $player) {
                                     $count++;
                                     $sender->sendMessage("§c" . $count . ") §b" . $player['username'] . "§c with §b" . $player['highscore']);
                                 }
                             } else {
                                 $sender->sendMessage("§cThis map doesn't exist.");
                             }
                         } else {
                             $sender->sendMessage("§cUsage: §b/pk topten [map name]");
                         }
                     }
                 }
             }
         }
         if ($args[0] == "create") {
             if (isset($args[1])) {
                 $this->arenaconf->set($args[1], array("date-of-creation" => date("d/m/Y"), "map-maker" => $sender->getName(), "level" => $sender->getLevel()->getName(), "floor-y" => 0, "start-position" => array("x" => 0, "y" => 0, "z" => 0, "yaw" => 360), "timer-block" => array("x" => 0, "y" => 0, "z" => 0), "end-block" => array("x" => 0, "y" => 0, "z" => 0)));
                 $sender->sendMessage("§cNew map '§b" . $args[1] . "§c' has been created.\n§cPlease use the follwing command to set the start position:\n§b/pk setstart " . strtolower($args[1]));
             } else {
                 $sender->sendMessage("§cUsage: §b/pk create [map name]");
             }
         } else {
             if ($args[0] == "setstart") {
                 if (isset($args[1])) {
                     if ($this->arenaconf->exists($args[1])) {
                         $newmap = $this->arenaconf->get($args[1]);
                         $newmap['start-position'] = array("x" => $sender->getFloorX(), "y" => $sender->getFloorY(), "z" => $sender->getFloorZ(), $sender->getYaw());
                         $this->arenaconf->set($args[1], $newmap);
                         $sender->sendMessage("§cAwesome! Now use the follwing command to set the floor that will reset you once you fall below/on it.\n§b/pk setfloor " . strtolower($args[1]));
                     } else {
                         $sender->sendMessage("§cThis map doesn't exist.");
                     }
                 } else {
                     $sender->sendMessage("§cUsage: §b/pk setfloor [map name]");
                 }
             } else {
                 if ($args[0] == "setfloor") {
                     if (isset($args[1])) {
                         if ($this->arenaconf->exists($args[1])) {
                             $newmap = $this->arenaconf->get($args[1]);
                             $newmap['floor-y'] = $sender->getFloorY();
                             $this->arenaconf->set($args[1], $newmap);
                             $sender->sendMessage("§cGreat! Now use the follwing command to set the timer start position.\n§b/pk settimer " . strtolower($args[1]));
                         } else {
                             $sender->sendMessage("§cThis map doesn't exist.");
                         }
                     } else {
//.........这里部分代码省略.........
开发者ID:SirGamer,项目名称:ParkourRunner,代码行数:101,代码来源:Runner.php


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