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


PHP Position::getBlock方法代码示例

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


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

示例1: updateSigns

 public function updateSigns()
 {
     $this->plugin->storage->signs->reload();
     foreach ($this->plugin->storage->signs->getAll() as $sign) {
         $signloc = $this->plugin->storage->signs->get($sign . ".location");
         $locx = new Position($signloc->getX() - 0.5, $signloc->getY(), $signloc->getZ() - 0.5, $signloc->getLevel());
         if ($locx->getBlock()->getID() == Item::SIGN_POST || $loc->getBlock()->getID() == Item::WALL_SIGN) {
             $signblock = $locx->getBlock();
             $lines = $signblock->getLines();
             if (strpos($sign, "leave")) {
                 $signLines = $this->plugin->config->get('sign')['LEAVE'];
                 $linecount = 0;
                 foreach ($signLines as $line) {
                     if ($linecount <= 3) {
                         $signblock->setLine($linecount, MessageM::replaceAll($line));
                     }
                     $linecount++;
                 }
                 $signblock->update();
             } else {
                 $linecount;
                 if (strpos($sign, "shop")) {
                     $signLines = $this->plugin->config->get('sign')['SHOP'];
                     $linecount = 0;
                     foreach ($signLines as $line) {
                         if ($linecount <= 3) {
                             $signblock->setLine($linecount, MessageM::replaceAll($line));
                         }
                         $linecount++;
                     }
                     $signblock->update();
                 } else {
                     foreach ($this->plugin->storage->arenaList as $arena) {
                         if (substr($lines[1], -strlen($arena->arenaName)) === $arena->arenaName) {
                             if ($arena::gameState == ArenaState::WAITING) {
                                 $signLines = $this->plugin->config->get('sign')['WAITING'];
                                 $linecount = 0;
                                 if ($signLines != null) {
                                     foreach ($signLines as $line) {
                                         if ($linecount <= 3) {
                                             $signblock->setLine($linecount, MessageM::replaceAll($line, ["arenaname-" . $arena->arenaName, "players-" . count($arena->playersInArena), "maxplayers-" . $arena->maxPlayers, "timeleft-" . $arena->timer]));
                                         }
                                         $linecount++;
                                     }
                                 }
                                 $signblock->update();
                             } else {
                                 if ($arena::gameState == ArenaState::STARTING) {
                                     $signLines = $this->plugin->config->get('sign')['STARTING'];
                                     $linecount = 0;
                                     if ($signLines != null) {
                                         foreach ($signLines as $line) {
                                             if (linecount <= 3) {
                                                 $signblock->setLine($linecount, MessageM::replaceAll($line, ["arenaname-" . $arena->arenaName, "players-" . count($arena->playersInArena), "maxplayers-" . $arena->maxPlayers, "timeleft-" . $arena->timer]));
                                             }
                                             $linecount++;
                                         }
                                     }
                                     $signblock->update();
                                 } else {
                                     if ($arena::gameState == ArenaState::INGAME) {
                                         $signLines = $this->plugin->config->get('sign')['INGAME'];
                                         $linecount = 0;
                                         if ($signLines != null) {
                                             foreach ($signLines as $line) {
                                                 if ($linecount <= 3) {
                                                     $signblock->setLine($linecount, MessageM::replaceAll($line, ["arenaname-" . $arena->arenaName, "players-" . count($arena->playersInArena), "maxplayers-" . $arena->maxPlayers, "timeleft-" . $arena->timer]));
                                                 }
                                                 $linecount++;
                                             }
                                         }
                                         $signblock->update();
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             removeSign($loc);
         }
     }
 }
开发者ID:survicraft,项目名称:pocketmine-BlockHunt,代码行数:84,代码来源:SignsHandler.php


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