getSide() публичный Метод

Returns a side Vector
public getSide ( integer $side, integer $step = 1 ) : Position
$side integer
$step integer
Результат Position
Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
 /**
  * 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);
 }
Пример #4
0
 /**
  * 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);
 }