getTiles() 공개 메소드

Returns a list of the Tile entities in this level
public getTiles ( ) : array
리턴 array
 /**
  * @param CommandSender $sender
  * @param Level $level
  */
 public function sendLevelInfo(CommandSender $sender, Level $level)
 {
     $sender->sendMessage("Name: " . $level->getName());
     $sender->sendMessage("Id: " . $level->getId());
     $sender->sendMessage("Entities: " . count($level->getEntities()));
     $sender->sendMessage("Players: " . count($level->getPlayers()));
     $sender->sendMessage("Tiles: " . count($level->getTiles()));
     $sender->sendMessage("Chunks: " . count($level->getChunks()));
     $sender->sendMessage("Loaders: " . count($level->getLoaders()));
     $sender->sendMessage("Spawn: " . $level->getSafeSpawn()->getFloorX() . ":" . $level->getSafeSpawn()->getFloorY() . ":" . $level->getSafeSpawn()->getFloorZ());
     $sender->sendMessage("Time: " . $level->getTime());
     $sender->sendMessage("Tick-rate: " . $level->getTickRate());
     $sender->sendMessage("Tick-rate-time: " . $level->getTickRateTime());
     $sender->sendMessage("Seed: " . $level->getSeed());
     $sender->sendMessage("Is-auto-saving: " . ($level->getAutoSave() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-generated: " . ($level->getServer()->isLevelGenerated($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-loaded: " . ($level->getServer()->isLevelLoaded($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
 }
예제 #2
0
 /**
  * @param Level $level
  * @return array 
  */
 public function getChests(Level $level)
 {
     $chests = array();
     foreach ($level->getTiles() as $tiles) {
         if ($tiles instanceof Chest) {
             array_push($chests, $tiles);
             if (count($chests) >= 1) {
                 return $chests;
             } else {
                 return false;
             }
         }
     }
 }