コード例 #1
0
ファイル: BedWars.php プロジェクト: SuperAdam47/BedWarsPE
 public function DestroyBlock(Block $Block, Player $Destroyer)
 {
     $X = $Block->GetX();
     $Y = $Block->GetY();
     $Z = $Block->GetZ();
     if ($Team = $this->getTeamByPlayer($Destroyer)) {
         if ($X == $Team->Bed[0]->getX() && $Y == $Team->Bed[0]->getY() && $Z == $Team->Bed[0]->getZ() || $X == $Team->Bed[1]->getX() && $Y == $Team->Bed[1]->getY() && $Z == $Team->Bed[1]->getZ()) {
             return true;
         }
     }
     foreach ($this->Teams as $name => $Team) {
         if ($X == $Team->Bed[0]->getX() && $Y == $Team->Bed[0]->getY() && $Z == $Team->Bed[0]->getZ() || $X == $Team->Bed[1]->getX() && $Y == $Team->Bed[1]->getY() && $Z == $Team->Bed[1]->getZ()) {
             $Team->BedStatus = 0;
             $this->sendMessageToAll(TextFormat::RED . $this->plugin->getMessage("bedwars.team.destroyed", $name));
             $this->updateTeams();
             $this->Level->setBlock(new Vector3($Team->Bed[0]->getX(), $Team->Bed[0]->getY(), $Team->Bed[0]->getZ()), Block::get(0), true, true);
             $this->Level->setBlock(new Vector3($Team->Bed[1]->getX(), $Team->Bed[1]->getY(), $Team->Bed[1]->getZ()), Block::get(0), true, true);
             return false;
         }
     }
     foreach ($this->BlocksPlaced as $Block) {
         if ($X == $Block->getX() && $Y == $Block->getY() && $Z == $Block->getZ()) {
             return false;
         }
     }
     return true;
 }