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


PHP Position::getSide方法代码示例

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


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

示例1: onEnable

 public function onEnable()
 {
     if (!file_exists($this->getDataFolder())) {
         mkdir($this->getDataFolder());
     }
     $this->saveDefaultConfig();
     $provider = $this->getConfig()->get("data-provider");
     switch (strtolower($provider)) {
         case "yaml":
             $this->provider = new YamlDataProvider($this->getDataFolder() . "Shops.yml", $this->getConfig()->get("auto-save"));
             break;
         default:
             $this->getLogger()->critical("Invalid data provider was given. EconomyShop will be terminated.");
             return;
     }
     $this->getLogger()->notice("Data provider was set to: " . $this->provider->getProviderName());
     $levels = [];
     foreach ($this->provider->getAll() as $shop) {
         if ($shop[9] !== -2) {
             if (!isset($levels[$shop[3]])) {
                 $levels[$shop[3]] = $this->getServer()->getLevelByName($shop[3]);
             }
             $pos = new Position($shop[0], $shop[1], $shop[2], $levels[$shop[3]]);
             $display = $pos;
             if ($shop[9] !== -1) {
                 $display = $pos->getSide($shop[9]);
             }
             $this->items[$shop[3]][] = new ItemDisplayer($display, Item::get($shop[4], $shop[5]), $pos);
         }
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $this->lang = json_decode(stream_get_contents($rsc = $this->getResource("lang_en.json")), true);
     // TODO: Language preferences
     @fclose($rsc);
 }
开发者ID:PocketMine-PHP7,项目名称:EconomyS-PHP7,代码行数:35,代码来源:EconomyShop.php

示例2: onEnable

 public function onEnable()
 {
     $this->saveDefaultConfig();
     if (!$this->selectLang()) {
         $this->getLogger()->warning("Invalid language option was given.");
     }
     $provider = $this->getConfig()->get("data-provider");
     switch (strtolower($provider)) {
         case "yaml":
             $this->provider = new YamlDataProvider($this->getDataFolder() . "Sells.yml", $this->getConfig()->get("auto-save"));
             break;
         default:
             $this->getLogger()->critical("Invalid data provider was given. EconomySell will be terminated.");
             return;
     }
     $this->getLogger()->notice("Data provider was set to: " . $this->provider->getProviderName());
     $levels = [];
     foreach ($this->provider->getAll() as $sell) {
         if ($sell[9] !== -2) {
             if (!isset($levels[$sell[3]])) {
                 $levels[$sell[3]] = $this->getServer()->getLevelByName($sell[3]);
             }
             $pos = new Position($sell[0], $sell[1], $sell[2], $levels[$sell[3]]);
             $display = $pos;
             if ($sell[9] !== -1) {
                 $display = $pos->getSide($sell[9]);
             }
             $this->items[$sell[3]][] = new ItemDisplayer($display, Item::get($sell[4], $sell[5]), $pos);
         }
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
 }
开发者ID:dog194,项目名称:EconomyS,代码行数:32,代码来源:EconomySell.php

示例3: getSide

 /**
  * Returns a side Vector
  *
  * @param int $side
  * @param int $step
  *
  * @return WeakPosition
  *
  * @throws LevelException
  */
 public function getSide($side, $step = 1)
 {
     assert($this->isValid());
     return WeakPosition::fromObject(parent::getSide($side, $step), $this->level);
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:15,代码来源:WeakPosition.php

示例4: getSide

 /**
  * Returns the Block on the side $side, works like Vector3::side()
  *
  * @param int $side
  * @param int $step
  *
  * @return Block
  */
 public function getSide($side, $step = 1)
 {
     $v = parent::getSide($side, $step);
     if ($this->isValid()) {
         return $this->getLevel()->getBlock($v);
     }
     return Block::get(Item::AIR, 0, $v);
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:16,代码来源:Block.php


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