public function build()
 {
     $materialMaxKey = count($this->floorMaterials) - 1;
     $level = $this->playerPrepLoc->getLevel();
     //		$level->getServer()->getLogger()->debug("Start rebuilding of spleef $this->name");
     for ($floor = 0; $floor < $this->floors; $floor++) {
         $y = $this->lowestY + $floor * $this->floorHeight;
         for ($x = $this->fromx; $x <= $this->tox; $x++) {
             for ($z = $this->fromz; $z <= $this->toz; $z++) {
                 $level->setBlock(new Vector3($x, $y, $z), $this->floorMaterials[mt_rand(0, $materialMaxKey)], false, false);
             }
         }
     }
     //		$level->getServer()->getLogger()->debug("Finished rebuilding of spleef $this->name");
 }
Example #2
0
 public function createTouchEffect(Location $position, $entityHeight, Location $damagerPosition, $damagerHeight)
 {
     if (isset($this->config["NU_EFFECT"]) && !$this->config["NU_EFFECT"]) {
         $position->getLevel()->addSound(new DoorSound($position));
         for ($i = 0; $i < 50; $i++) {
             $position->getLevel()->addParticle(new HeartParticle($position->add(mt_rand(-1, 1), mt_rand(-1, 1) + $entityHeight, mt_rand(-1, 1))));
         }
         for ($i = 0; $i < 50; $i++) {
             $damagerPosition->getLevel()->addParticle(new HeartParticle($damagerPosition->add(mt_rand(-1, 1), mt_rand(-1, 1) + $damagerHeight, mt_rand(-1, 1))));
         }
     } else {
         $position->getLevel()->addSound(new DoorSound($position));
         for ($i = 0; $i < 50; $i++) {
             $position->getLevel()->addParticle(new DustParticle($position->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $entityHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
         }
         for ($i = 0; $i < 50; $i++) {
             $damagerPosition->getLevel()->addParticle(new DustParticle($damagerPosition->add(mt_rand(-1, 1) / 2, mt_rand(-1, 1) / 2 + $damagerHeight, mt_rand(-1, 1) / 2), 153, 51, 255));
         }
     }
 }
Example #3
0
 public static function fromPosition($name, Location $pos)
 {
     return new BaseLocation($name, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch());
 }
 /**
  * @param $home
  * @param Location $pos
  * @return bool
  */
 public function setHome($home, Location $pos)
 {
     if (!$this->getPlugin()->validateName($home, false)) {
         return false;
     }
     $this->homes[$home] = new BaseLocation($home, $pos->getX(), $pos->getY(), $pos->getZ(), $pos->getLevel(), $pos->getYaw(), $pos->getPitch());
     return true;
 }