Ejemplo n.º 1
0
 /**
  * @param iZone $plugin
  * @param int $name
  * @param Player $owner
  * @param Position $pos1
  * @param Position $pos2
  */
 public function __construct(iZone $plugin, $name, $owner, Position $pos1, Position $pos2, $pvpAvailable = false)
 {
     $this->plugin = $plugin;
     $this->name = $name;
     $this->minX = min($pos1->x, $pos2->x);
     $this->minY = min($pos1->y, $pos2->y);
     $this->minZ = min($pos1->x, $pos2->z);
     $this->maxX = max($pos1->x, $pos2->x);
     $this->maxY = max($pos1->y, $pos2->y);
     $this->maxZ = max($pos1->z, $pos2->z);
     $this->owner = $owner instanceof Player ? $owner->getName() : $owner;
     $this->levelName = $pos1->getLevel()->getName();
     //Register owner's permissions
     if ($owner instanceof Player) {
         $this->plugin->addPermission($owner, $name . OWNER);
         $this->plugin->getDataProvider()->setPermission($owner, $name . OWNER);
     }
     $this->pvpAvailable = $pvpAvailable;
 }