public function run(WorldEditSession $session, array $args)
 {
     $params = new FormattedArguments($args);
     if ($params->enabled("b")) {
         $pos = $session->getBookmark();
         $level = $pos->getLevel($session->getMain()->getServer());
     } elseif (($name = $params->opt("b")) !== null) {
         $pos = $session->getBookmark($name);
         $level = $pos->getLevel($session->getMain()->getServer());
     } elseif (($name = $params->opt("p")) !== null) {
         $pos = $session->getMain()->getServer()->getPlayer($name);
         $level = $pos->getLevel();
         if (!$pos instanceof Player) {
             return Lang::ERR_OFFLINE;
         }
     } else {
         $pos = $session->getLocation();
         $level = $pos->getLevel();
     }
     $name = $params->opt("n", "default");
     $sel = $session->getSelection($name);
     if (!$sel instanceof CylinderSpace) {
         $sel = new CylinderSpace();
         $sel->setLevelName($level->getName());
         $session->setSelection($sel, $name);
     }
     if ($this->isTop) {
         $sel->setTopCenter($pos);
     } else {
         $sel->setBaseCenter($pos);
     }
     $session->sendMessage(Lang::SELECTION_POS_SUCCESS, ["COORD_X" => $pos->x, "COORD_Y" => $pos->y, "COORD_Z" => $pos->z, "TOP_OR_BASE" => $session->translate($this->isTop ? Lang::PHRASE_TOP_CENTER : Lang::PHRASE_BASE_CENTER)]);
     $session->sendMessage(Lang::SELECTION_POS_INFO);
     $session->sendMessageDirect($sel->name($session));
     return null;
 }
 public function standardCylinderOffset($offset, &$x, &$y, &$z)
 {
     $lengthX = $this->space->getLengthX();
     $lengthY = $this->space->getLengthY();
     $lengthZ = $this->space->getLengthZ();
     if ($offset < $lengthX * $lengthY * $lengthZ) {
         $z = $offset % $lengthZ;
         $offset = (int) ($offset / $lengthZ);
         $y = $offset % $lengthY;
         $offset = (int) ($offset / $lengthY);
         $x = $offset;
         $x += $this->space->getMinX();
         $y += $this->space->getMinY();
         $z += $this->space->getMinZ();
         return true;
     }
     return false;
 }