getServer() публичный Метод

public getServer ( ) : Server
Результат pocketmine\Server
 public function __construct(Level $level, $duration = 1200)
 {
     $this->level = $level;
     $this->weatherNow = self::SUNNY;
     $this->duration = $duration;
     $this->lastUpdate = $level->getServer()->getTick();
     $this->temporalVector = new Vector3(0, 0, 0);
 }
 public function getServer()
 {
     return $this->level->getServer();
 }
 /**
  * @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"));
 }
Пример #4
0
 /**
  *
  * @param Level $level        	
  * @param unknown $base        	
  * @param unknown $competition        	
  */
 public function addWorld(Level $level, $base, $competition)
 {
     $fileutil = new FileUtil();
     $source = $level->getServer()->getDataPath() . "worlds/" . $base . "/";
     $dest = $level->getServer()->getDataPath() . "worlds/" . $competition . "/";
     $this->deleteWorld($level, $competition);
     if ($fileutil->xcopy($source, $dest)) {
         $this->log("New Hunger Game Competition World [" . $competition . "] created!");
         try {
             $level->getServer()->loadLevel($competition);
         } catch (\Exception $e) {
             $this->log("level loading error: " . $e->getMessage());
         }
         $this->log("loaded world: " . $competition);
     } else {
         $this->log("problem creating new map. please contact administrator.");
     }
 }
Пример #5
0
 public function lavaSpawn(Level $level, $x, $y, $z)
 {
     $level->getServer()->getLogger()->info("生成岩浆中 " . "floor({$x})" . ", " . "floor({$y})" . ", " . floor($z));
     for ($xx = $x - 20; $xx <= $x + 20; $xx++) {
         for ($zz = $z - 20; $zz <= $z + 20; $zz++) {
             for ($yy = $y; $yy > $y - 4; $yy--) {
                 $id = $level->getBlockIdAt($xx, $yy, $zz);
                 if ($id == 0) {
                     $level->setBlockIdAt($xx, $yy, $zz, 10);
                     $level->setBlockDataAt($xx, $yy, $zz, 0);
                 }
             }
         }
     }
     $level->setBlock(new Vector3($x, $y, $z), new Lava());
 }