예제 #1
0
파일: Main.php 프로젝트: Rspuds/AreaEffects
 public function isInArea(Player $player, $area)
 {
     if ($player->getFloorX() >= $area['pos1'['x']] && $player->getFloorX() <= $area['pos2'['x']] && $player->getFloorY() >= $area['pos1'['y']] && $player->getFloorY() <= $area['pos2'['y']] && $player->getFloorZ() >= $area['pos1'['z']] && $player->getFloorZ() <= $area['pos2'['y']] && $area['level'] == $player->getLevel()) {
         return true;
     } else {
         return false;
     }
 }
예제 #2
0
파일: Main.php 프로젝트: EmreTr1/PunishPE
 private function unJail(Player $player)
 {
     /*--Get player coords and ground coords--*/
     $px = round($player->getX());
     $py = round($player->getY());
     $pz = round($player->getZ());
     $gx = round($player->getFloorX());
     $gy = round($player->getFloorY());
     $gz = round($player->getFloorZ());
     $level = $player->getLevel();
     /*--Define the position of the 16 blocks around the player--*/
     $pos1 = new Vector3($px + 1, $py, $pz);
     $pos2 = new Vector3($px + 1, $py, $pz + 1);
     $pos3 = new Vector3($px - 1, $py, $pz + 1);
     $pos4 = new Vector3($px + 1, $py, $pz - 1);
     $pos5 = new Vector3($px, $py, $pz + 1);
     $pos6 = new Vector3($px - 1, $py, $pz);
     $pos7 = new Vector3($px, $py, $pz - 1);
     $pos8 = new Vector3($px - 1, $py + 1, $pz - 1);
     $pos9 = new Vector3($px + 1, $py + 1, $pz);
     $pos10 = new Vector3($px + 1, $py + 1, $pz + 1);
     $pos11 = new Vector3($px - 1, $py + 1, $pz + 1);
     $pos12 = new Vector3($px + 1, $py + 1, $pz - 1);
     $pos13 = new Vector3($px, $py + 1, $pz + 1);
     $pos14 = new Vector3($px - 1, $py + 1, $pz);
     $pos15 = new Vector3($px, $py + 1, $pz - 1);
     $pos16 = new Vector3($px - 1, $py + 1, $pz - 1);
     /*--And remove the blocks of bedrock--*/
     $this->getServer()->getLevel($level)->setBlock($pos1, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos2, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos3, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos4, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos5, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos6, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos7, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos8, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos9, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos10, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos11, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos12, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos13, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos14, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos15, Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock($pos16, Block::get(0, 0));
     /*--Break the blocks under and above the player--*/
     $this->getServer()->getLevel($level)->setBlock(new Vector3($px, $py + 2, $pz), Block::get(0, 0));
     $this->getServer()->getLevel($level)->setBlock(new Vector3($gx, $gy, $gz), Block::get(0, 0));
     return true;
 }
예제 #3
0
 public function onJoin()
 {
     foreach ($this->player->getLevel()->getChunkPlayers($this->player->getFloorX() >> 4, $this->player->getFloorZ() >> 4) as $other) {
         $other->hidePlayer($this->player);
         $this->invisibleFrom[$other->getId()] = true;
     }
     $this->prepareLogin();
 }