當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Generator::addGenerator方法代碼示例

本文整理匯總了PHP中pocketmine\level\generator\Generator::addGenerator方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generator::addGenerator方法的具體用法?PHP Generator::addGenerator怎麽用?PHP Generator::addGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\level\generator\Generator的用法示例。


在下文中一共展示了Generator::addGenerator方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onLoad

 public function onLoad()
 {
     Generator::addGenerator(NoneGN::class, "None");
     Generator::addGenerator(OreFlatGN::class, "OreFlat");
     Generator::addGenerator(SkyBlockGN::class, "SkyBlock");
     Generator::addGenerator(SkyGridGN::class, "SkyGrid");
 }
開發者ID:Skull3x,項目名稱:MineBlock,代碼行數:7,代碼來源:WorldGenerator.php

示例2: onEnable

 public function onEnable()
 {
     $api = $this->getServer()->getApiVersion();
     if (version_compare($api, "1.12.0") >= 0) {
         $this->getLogger()->info(TextFormat::RED . "WARNING: PMv1.5 support is experimental!");
         Generator::addGenerator(NotSoFlat::class, "notsoflat");
     } else {
         Generator::addGenerator(NotSoFlatOld::class, "notsoflat");
     }
 }
開發者ID:AvivShopen,項目名稱:bad-plugins,代碼行數:10,代碼來源:Main.php

示例3: onEnable

 public function onEnable()
 {
     Generator::addGenerator(ApartGN::class, "Apart");
     Generator::addGenerator(Ice::class, "Ice");
     Generator::addGenerator(Lava::class, "Lava");
     Generator::addGenerator(ManySkyBlockGN::class, "ManySkyBlock");
     Generator::addGenerator(ManyTreeGN::class, "ManyTree");
     Generator::addGenerator(MultySkyBlockGN::class, "MultySkyBlock");
     Generator::addGenerator(MultySpecialSkyBlockGN::class, "MultySpecialSkyBlock");
     Generator::addGenerator(NoneGN::class, "None");
     Generator::addGenerator(OreFlatGN::class, "OreFlat");
     Generator::addGenerator(OreTreeFlatGN::class, "OreTreeFlat");
     Generator::addGenerator(SkyBlockGN::class, "SkyBlock");
     Generator::addGenerator(SkyGridGN::class, "SkyGrid");
     Generator::addGenerator(TreeGN::class, "Tree");
     Generator::addGenerator(WaterGN::class, "Water");
     Generator::addGenerator(WhiteWayGN::class, "WhiteWay");
 }
開發者ID:stoastye85,項目名稱:Plugins,代碼行數:18,代碼來源:WorldGenerator.php

示例4: __construct


//.........這裏部分代碼省略.........
     $this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
     $this->banByIP->load();
     $this->maxPlayers = $this->getConfigInt("max-players", 20);
     $this->setAutoSave($this->getConfigBoolean("auto-save", true));
     if ($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3) {
         $this->setConfigInt("difficulty", 3);
     }
     define("pocketmine\\DEBUG", (int) $this->getProperty("debug.level", 1));
     if ($this->logger instanceof MainLogger) {
         $this->logger->setLogDebug(\pocketmine\DEBUG > 1);
     }
     if (\pocketmine\DEBUG >= 0) {
         @cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
     }
     $this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === "" ? "*" : $this->getIp(), $this->getPort()]));
     define("BOOTUP_RANDOM", @Utils::getRandomBytes(16));
     $this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
     $this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
     $this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
     $this->network = new Network($this);
     $this->network->setName($this->getMotd());
     $this->logger->info($this->getLanguage()->translateString("pocketmine.server.info", [$this->getName(), ($version->isDev() ? TextFormat::YELLOW : "") . $version->get(true) . TextFormat::WHITE, $this->getCodename(), $this->getApiVersion()]));
     $this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()]));
     Timings::init();
     $this->consoleSender = new ConsoleCommandSender();
     $this->commandMap = new SimpleCommandMap($this);
     $this->registerEntities();
     $this->registerTiles();
     InventoryType::init();
     Block::init();
     Item::init();
     Biome::init();
     Effect::init();
     Enchantment::init();
     Attribute::init();
     /** TODO: @deprecated */
     TextWrapper::init();
     $this->craftingManager = new CraftingManager();
     $this->pluginManager = new PluginManager($this, $this->commandMap);
     $this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
     $this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
     $this->profilingTickRate = (double) $this->getProperty("settings.profile-report-trigger", 20);
     $this->pluginManager->registerInterface(PharPluginLoader::class);
     $this->pluginManager->registerInterface(ScriptPluginLoader::class);
     set_exception_handler([$this, "exceptionHandler"]);
     register_shutdown_function([$this, "crashDump"]);
     $this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
     $this->network->registerInterface(new RakLibInterface($this));
     $this->pluginManager->loadPlugins($this->pluginPath);
     $this->updater = new AutoUpdater($this, $this->getProperty("auto-updater.host", "www.pocketmine.net"));
     $this->enablePlugins(PluginLoadOrder::STARTUP);
     LevelProviderManager::addProvider($this, Anvil::class);
     LevelProviderManager::addProvider($this, McRegion::class);
     if (extension_loaded("leveldb")) {
         $this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
         LevelProviderManager::addProvider($this, LevelDB::class);
     }
     Generator::addGenerator(Flat::class, "flat");
     Generator::addGenerator(Normal::class, "normal");
     Generator::addGenerator(Normal::class, "default");
     Generator::addGenerator(Nether::class, "hell");
     Generator::addGenerator(Nether::class, "nether");
     foreach ((array) $this->getProperty("worlds", []) as $name => $worldSetting) {
         if ($this->loadLevel($name) === false) {
             $seed = $this->getProperty("worlds.{$name}.seed", time());
             $options = explode(":", $this->getProperty("worlds.{$name}.generator", Generator::getGenerator("default")));
             $generator = Generator::getGenerator(array_shift($options));
             if (count($options) > 0) {
                 $options = ["preset" => implode(":", $options)];
             } else {
                 $options = [];
             }
             $this->generateLevel($name, $seed, $generator, $options);
         }
     }
     if ($this->getDefaultLevel() === null) {
         $default = $this->getConfigString("level-name", "world");
         if (trim($default) == "") {
             $this->getLogger()->warning("level-name cannot be null, using default");
             $default = "world";
             $this->setConfigString("level-name", "world");
         }
         if ($this->loadLevel($default) === false) {
             $seed = $this->getConfigInt("level-seed", time());
             $this->generateLevel($default, $seed === 0 ? time() : $seed);
         }
         $this->setDefaultLevel($this->getLevelByName($default));
     }
     $this->properties->save(true);
     if (!$this->getDefaultLevel() instanceof Level) {
         $this->getLogger()->emergency($this->getLanguage()->translateString("pocketmine.level.defaultError"));
         $this->forceShutdown();
         return;
     }
     if ($this->getProperty("ticks-per.autosave", 6000) > 0) {
         $this->autoSaveTicks = (int) $this->getProperty("ticks-per.autosave", 6000);
     }
     $this->enablePlugins(PluginLoadOrder::POSTWORLD);
     $this->start();
 }
開發者ID:ZenaGamingsky,項目名稱:PocketBox,代碼行數:101,代碼來源:Server.php

示例5: onEnable

 public function onEnable()
 {
     $this->getLogger()->info("Loading MyPlot");
     self::$instance = $this;
     $this->saveDefaultConfig();
     $this->reloadConfig();
     @mkdir($this->getDataFolder());
     @mkdir($this->getDataFolder() . "worlds");
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $lang = $this->getConfig()->get("language", BaseLang::FALLBACK_LANGUAGE);
     $this->baseLang = new BaseLang($lang, $this->getFile() . "resources/");
     // Initialize DataProvider
     $cacheSize = $this->getConfig()->get("PlotCacheSize");
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
         default:
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
     }
     // Initialize EconomyProvider
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         }
     }
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
 }
開發者ID:gitter-badger,項目名稱:MyPlot,代碼行數:30,代碼來源:MyPlot.php

示例6: __construct


//.........這裏部分代碼省略.........
     $this->logger->info($this->getName() . " is distributed under the LGPL License");
     PluginManager::$pluginParentTimer = new TimingsHandler("** Plugins");
     Timings::init();
     $this->consoleSender = new ConsoleCommandSender();
     $this->commandMap = new SimpleCommandMap($this);
     $this->registerEntities();
     $this->registerTiles();
     InventoryType::init();
     Block::init();
     Item::init();
     TextWrapper::init();
     $this->craftingManager = new CraftingManager();
     $this->pluginManager = new PluginManager($this, $this->commandMap);
     $this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
     $this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
     $this->pluginManager->registerInterface(PharPluginLoader::class);
     \set_exception_handler([$this, "exceptionHandler"]);
     register_shutdown_function([$this, "crashDump"]);
     $plugins = $this->pluginManager->loadPlugins($this->pluginPath);
     $configPlugins = $this->getAdvancedProperty("plugins", []);
     if (count($configPlugins) > 0) {
         $this->getLogger()->info("Checking extra plugins");
         $loadNew = false;
         foreach ($configPlugins as $plugin => $download) {
             if (!isset($plugins[$plugin])) {
                 $path = $this->pluginPath . "/" . $plugin . ".phar";
                 if (substr($download, 0, 4) === "http") {
                     $this->getLogger()->info("Downloading " . $plugin);
                     file_put_contents($path, Utils::getURL($download));
                 } else {
                     file_put_contents($path, file_get_contents($download));
                 }
                 $loadNew = true;
             }
         }
         if ($loadNew) {
             $this->pluginManager->loadPlugins($this->pluginPath);
         }
     }
     $this->enablePlugins(PluginLoadOrder::STARTUP);
     if ($this->getProperty("chunk-generation.use-async", true)) {
         $this->generationManager = new GenerationRequestManager($this);
     } else {
         $this->generationManager = new GenerationInstanceManager($this);
     }
     LevelProviderManager::addProvider($this, Anvil::class);
     LevelProviderManager::addProvider($this, McRegion::class);
     if (extension_loaded("leveldb")) {
         $this->logger->debug("Enabling LevelDB support");
         LevelProviderManager::addProvider($this, LevelDB::class);
     }
     Generator::addGenerator(Flat::class, "flat");
     Generator::addGenerator(Normal::class, "normal");
     Generator::addGenerator(Normal::class, "default");
     foreach ((array) $this->getProperty("worlds", []) as $name => $worldSetting) {
         if ($this->loadLevel($name) === false) {
             $seed = $this->getProperty("worlds.{$name}.seed", time());
             $options = explode(":", $this->getProperty("worlds.{$name}.generator", Generator::getGenerator("default")));
             $generator = Generator::getGenerator(array_shift($options));
             if (count($options) > 0) {
                 $options = ["preset" => implode(":", $options)];
             } else {
                 $options = [];
             }
             $this->generateLevel($name, $seed, $generator, $options);
         }
     }
     if ($this->getDefaultLevel() === null) {
         $default = $this->getConfigString("level-name", "world");
         if (trim($default) == "") {
             $this->getLogger()->warning("level-name cannot be null, using default");
             $default = "world";
             $this->setConfigString("level-name", "world");
         }
         if ($this->loadLevel($default) === false) {
             $seed = $this->getConfigInt("level-seed", time());
             $this->generateLevel($default, $seed === 0 ? time() : $seed);
         }
         $this->setDefaultLevel($this->getLevelByName($default));
     }
     $this->properties->save();
     if (!$this->getDefaultLevel() instanceof Level) {
         $this->getLogger()->emergency("No default level has been loaded");
         $this->forceShutdown();
         return;
     }
     $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([Cache::class, "cleanup"]), $this->getProperty("ticks-per.cache-cleanup", 900), $this->getProperty("ticks-per.cache-cleanup", 900));
     if ($this->getAutoSave() and $this->getProperty("ticks-per.autosave", 6000) > 0) {
         $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doAutoSave"]), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000));
     }
     if ($this->getProperty("chunk-gc.period-in-ticks", 600) > 0) {
         $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doLevelGC"]), $this->getProperty("chunk-gc.period-in-ticks", 600), $this->getProperty("chunk-gc.period-in-ticks", 600));
     }
     $this->scheduler->scheduleRepeatingTask(new GarbageCollectionTask(), 900);
     $this->enablePlugins(PluginLoadOrder::POSTWORLD);
     if ($this->getAdvancedProperty("main.player-shuffle", 0) > 0) {
         $this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "shufflePlayers"]), $this->getAdvancedProperty("main.player-shuffle", 0), $this->getAdvancedProperty("main.player-shuffle", 0));
     }
     $this->start();
 }
開發者ID:ZenaGamingsky,項目名稱:Steadfast2,代碼行數:101,代碼來源:Server.php

示例7: onEnable

 public function onEnable()
 {
     self::$instance = $this;
     $folder = $this->getDataFolder();
     if (!is_dir($folder)) {
         mkdir($folder);
     }
     if (!is_dir($folder . "worlds")) {
         mkdir($folder . "worlds");
     }
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $this->saveDefaultConfig();
     $this->reloadConfig();
     $this->getLogger()->info(TextFormat::GREEN . "Loading the Plot Framework!");
     $this->getLogger()->warning(TextFormat::YELLOW . "It seems that you are running the development build of MyPlot! Thats cool, but it CAN be very, very buggy! Just be careful when using this plugin and report any issues to" . TextFormat::GOLD . " http://github.com/wiez/MyPlot/issues");
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
         default:
             $this->dataProvider = new SQLiteDataProvider($this);
             break;
     }
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         } else {
             $this->economyProvider = null;
         }
     } else {
         $this->economyProvider = null;
     }
 }
開發者ID:Timm03,項目名稱:MyPlot,代碼行數:35,代碼來源:MyPlot.php

示例8: onEnable

 public function onEnable()
 {
     $this->getLogger()->info(TextFormat::YELLOW . "enabled!");
     Generator::addGenerator(HyperPlotWorld::class, Gen::NAME);
 }
開發者ID:Gumbrat,項目名稱:Pocketmine-Plugins,代碼行數:5,代碼來源:HyperPlotWorld.php

示例9: onEnable

 public function onEnable()
 {
     self::$instance = $this;
     $folder = $this->getDataFolder();
     if (!is_dir($folder)) {
         mkdir($folder);
     }
     if (!is_dir($folder . "worlds")) {
         mkdir($folder . "worlds");
     }
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $this->saveDefaultConfig();
     $this->reloadConfig();
     $this->getLogger()->info(TextFormat::GREEN . "Loading the Plot Framework!");
     $this->getLogger()->warning(TextFormat::YELLOW . "It seems that you are running the development build of MyPlot! Thats cool, but it CAN be very, very buggy! Just be careful when using this plugin and report any issues to" . TextFormat::GOLD . " http://github.com/wiez/MyPlot/issues");
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
     $cacheSize = $this->getConfig()->get("PlotCacheSize");
     $cacheAll = $this->getConfig()->get("CacheAllPlots") == true;
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
             die("sqlite not supported for myplot in this fork");
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
         default:
             die("only mysql supported for myplot in this fork");
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
         case "mysql":
             $this->dataProvider = new MYSQLDataProvider($this, $cacheSize, $cacheAll);
             break;
     }
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         } else {
             $this->economyProvider = null;
         }
     } else {
         $this->economyProvider = null;
     }
     $this->usesVotingAPI = false;
     if ($this->getConfig()->get("UseMPServers_voting") == true) {
         $this->usesVotingAPI = true;
         $apiKey = $this->getConfig()->get("MPServers_voting_API_key");
         $votingURL = $this->getConfig()->get("MPServers_voting_direct_URL");
         $freePlotsBeforeVoting = $this->getConfig()->get("FreePlotsBeforeVoting");
         $this->votingProvider = new VotingProvider($this, $apiKey, $freePlotsBeforeVoting, $votingURL);
     }
     $bcPlugin = $this->getServer()->getPluginManager()->getPlugin("BuddyChannels");
     if (!is_null($bcPlugin)) {
         $chatFormatter = new \MyPlot\ChatMessageFormatter($this);
     }
 }
開發者ID:mwvent,項目名稱:WattzMCPE-MyPlot,代碼行數:56,代碼來源:MyPlot.php

示例10: __construct


//.........這裏部分代碼省略.........
         Timings::init();
         $this->consoleSender = new ConsoleCommandSender();
         $this->commandMap = new SimpleCommandMap($this);
         $this->registerEntities();
         $this->registerTiles();
         InventoryType::init(min(32, $this->inventoryNum));
         //Bigger than 32 with cause problems
         Block::init();
         Item::init();
         Biome::init();
         Effect::init();
         Enchantment::init();
         Attribute::init();
         /** TODO: @deprecated */
         //TextWrapper::init();
         $this->craftingManager = new CraftingManager($this->readRecipesFromJson);
         $this->pluginManager = new PluginManager($this, $this->commandMap);
         $this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
         $this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
         $this->profilingTickRate = (double) $this->getProperty("settings.profile-report-trigger", 20);
         $this->pluginManager->registerInterface(PharPluginLoader::class);
         $this->pluginManager->registerInterface(FolderPluginLoader::class);
         $this->pluginManager->registerInterface(ScriptPluginLoader::class);
         //set_exception_handler([$this, "exceptionHandler"]);
         register_shutdown_function([$this, "crashDump"]);
         $this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
         $this->network->registerInterface(new RakLibInterface($this));
         $this->pluginManager->loadPlugins($this->pluginPath);
         //$this->updater = new AutoUpdater($this, $this->getProperty("auto-updater.host", "www.pocketmine.net"));
         $this->enablePlugins(PluginLoadOrder::STARTUP);
         LevelProviderManager::addProvider($this, Anvil::class);
         LevelProviderManager::addProvider($this, McRegion::class);
         if (extension_loaded("leveldb")) {
             $this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
             LevelProviderManager::addProvider($this, LevelDB::class);
         }
         Generator::addGenerator(Flat::class, "flat");
         Generator::addGenerator(Normal::class, "normal");
         Generator::addGenerator(Normal::class, "default");
         Generator::addGenerator(Nether::class, "hell");
         Generator::addGenerator(Nether::class, "nether");
         foreach ((array) $this->getProperty("worlds", []) as $name => $worldSetting) {
             if ($this->loadLevel($name) === false) {
                 $seed = $this->getProperty("worlds.{$name}.seed", time());
                 $options = explode(":", $this->getProperty("worlds.{$name}.generator", Generator::getGenerator("default")));
                 $generator = Generator::getGenerator(array_shift($options));
                 if (count($options) > 0) {
                     $options = ["preset" => implode(":", $options)];
                 } else {
                     $options = [];
                 }
                 $this->generateLevel($name, $seed, $generator, $options);
             }
         }
         if ($this->getDefaultLevel() === null) {
             $default = $this->getConfigString("level-name", "world");
             if (trim($default) == "") {
                 $this->getLogger()->warning("level-name cannot be null, using default");
                 $default = "world";
                 $this->setConfigString("level-name", "world");
             }
             if ($this->loadLevel($default) === false) {
                 $seed = $this->getConfigInt("level-seed", time());
                 $this->generateLevel($default, $seed === 0 ? time() : $seed);
             }
             $this->setDefaultLevel($this->getLevelByName($default));
         }
         $this->properties->save(true);
         if (!$this->getDefaultLevel() instanceof Level) {
             $this->getLogger()->emergency($this->getLanguage()->translateString("pocketmine.level.defaultError"));
             $this->forceShutdown();
             return;
         }
         if ($this->netherEnabled) {
             if (!$this->loadLevel($this->netherName)) {
                 //$this->logger->info("正在生成地獄 ".$this->netherName);
                 $this->generateLevel($this->netherName, time(), Generator::getGenerator("nether"));
             }
             $this->netherLevel = $this->getLevelByName($this->netherName);
         }
         if ($this->getProperty("ticks-per.autosave", 6000) > 0) {
             $this->autoSaveTicks = (int) $this->getProperty("ticks-per.autosave", 6000);
         }
         $this->enablePlugins(PluginLoadOrder::POSTWORLD);
         if ($this->aiEnabled) {
             $this->aiHolder = new AIHolder($this);
         }
         if ($this->dserverConfig["enable"] and $this->getAdvancedProperty("dserver.server-list", "") != "") {
             $this->scheduler->scheduleRepeatingTask(new CallbackTask([$this, "updateDServerInfo"]), $this->dserverConfig["timer"]);
         }
         if ($cfgVer != $advVer) {
             $this->logger->notice("Your genisys.yml needs update");
             $this->logger->notice("Current Version: {$advVer}   Latest Version: {$cfgVer}");
         }
         $this->generateRecipeList();
         $this->start();
     } catch (\Throwable $e) {
         $this->exceptionHandler($e);
     }
 }
開發者ID:xuxugzs,項目名稱:Genisys,代碼行數:101,代碼來源:Server.php

示例11: __construct


//.........這裏部分代碼省略.........
         ini_set('assert.exception', 1);
         if ($this->logger instanceof MainLogger) {
             $this->logger->setLogDebug(\pocketmine\DEBUG > 1);
         }
         if (\pocketmine\DEBUG >= 0) {
             @cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
         }
         $this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp() === "" ? "*" : $this->getIp(), $this->getPort()]));
         define("BOOTUP_RANDOM", random_bytes(16));
         $this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
         $this->getLogger()->debug("Server unique id: " . $this->getServerUniqueId());
         $this->getLogger()->debug("Machine unique id: " . Utils::getMachineUniqueId());
         $this->network = new Network($this);
         $this->network->setName($this->getMotd());
         $this->logger->info($this->getLanguage()->translateString("pocketmine.server.info", [$this->getName(), $this->getPocketMineVersion(), $this->getCodename(), $this->getApiVersion(), $this->getPocketMineBuild()]));
         $this->logger->info($this->getLanguage()->translateString("pocketmine.server.license", [$this->getName()]));
         Timings::init();
         $this->consoleSender = new ConsoleCommandSender();
         $this->commandMap = new SimpleCommandMap($this);
         $this->registerEntities();
         $this->registerTiles();
         InventoryType::init();
         Block::init();
         Item::init();
         Biome::init();
         Effect::init();
         Enchantment::init();
         Attribute::init();
         EnchantmentLevelTable::init();
         Color::init();
         $this->craftingManager = new CraftingManager();
         $this->pluginManager = new PluginManager($this, $this->commandMap);
         $this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);
         $this->pluginManager->setUseTimings($this->getProperty("settings.enable-profiling", false));
         $this->profilingTickRate = (double) $this->getProperty("settings.profile-report-trigger", 20);
         $this->pluginManager->registerInterface(PharPluginLoader::class);
         $this->pluginManager->registerInterface(ScriptPluginLoader::class);
         register_shutdown_function([$this, "crashDump"]);
         $this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);
         $this->network->registerInterface(new RakLibInterface($this));
         $this->pluginManager->loadPlugins($this->pluginPath);
         $this->updater = new AutoUpdater($this, $this->getProperty("auto-updater.host", "jenkins.clearskyteam.org"));
         $this->enablePlugins(PluginLoadOrder::STARTUP);
         LevelProviderManager::addProvider($this, Anvil::class);
         LevelProviderManager::addProvider($this, McRegion::class);
         if (extension_loaded("leveldb")) {
             $this->logger->debug($this->getLanguage()->translateString("pocketmine.debug.enable"));
             LevelProviderManager::addProvider($this, LevelDB::class);
         }
         Generator::addGenerator(Flat::class, "flat");
         Generator::addGenerator(Normal::class, "normal");
         Generator::addGenerator(Normal::class, "default");
         Generator::addGenerator(Nether::class, "hell");
         Generator::addGenerator(Nether::class, "nether");
         foreach ((array) $this->getProperty("worlds", []) as $name => $worldSetting) {
             if ($this->loadLevel($name) === false) {
                 $seed = $this->getProperty("worlds.{$name}.seed", time());
                 $options = explode(":", $this->getProperty("worlds.{$name}.generator", Generator::getGenerator("default")));
                 $generator = Generator::getGenerator(array_shift($options));
                 if (count($options) > 0) {
                     $options = ["preset" => implode(":", $options)];
                 } else {
                     $options = [];
                 }
                 $this->generateLevel($name, $seed, $generator, $options);
             }
         }
         if ($this->getDefaultLevel() === null) {
             $default = $this->getConfigString("level-name", "world");
             if (trim($default) == "") {
                 $this->getLogger()->warning("level-name cannot be null, using default");
                 $default = "world";
                 $this->setConfigString("level-name", "world");
             }
             if ($this->loadLevel($default) === false) {
                 $seed = getopt("", ["level-seed::"])["level-seed"] ?? $this->properties->get("level-seed", time());
                 if (!is_numeric($seed) or bccomp($seed, "9223372036854775807") > 0) {
                     $seed = Utils::javaStringHash($seed);
                 } elseif (PHP_INT_SIZE === 8) {
                     $seed = (int) $seed;
                 }
                 $this->generateLevel($default, $seed === 0 ? time() : $seed);
             }
             $this->setDefaultLevel($this->getLevelByName($default));
         }
         $this->properties->save(true);
         if (!$this->getDefaultLevel() instanceof Level) {
             $this->getLogger()->emergency($this->getLanguage()->translateString("pocketmine.level.defaultError"));
             $this->forceShutdown();
             return;
         }
         if ($this->getProperty("ticks-per.autosave", 6000) > 0) {
             $this->autoSaveTicks = (int) $this->getProperty("ticks-per.autosave", 6000);
         }
         $this->enablePlugins(PluginLoadOrder::POSTWORLD);
         $this->start();
     } catch (\Throwable $e) {
         $this->exceptionHandler($e);
     }
 }
開發者ID:robske110,項目名稱:ClearSky,代碼行數:101,代碼來源:Server.php

示例12: onEnable

 public function onEnable()
 {
     Generator::addGenerator(WorldGen::class, WorldGen::NAME);
 }
開發者ID:HeechFive,項目名稱:pocketmine-plugins,代碼行數:4,代碼來源:Main.php

示例13: onEnable

 public function onEnable()
 {
     //$this->getServer()->getGenerationManager()->addNamespace(__NAMESPACE__, realpath(dirname(__FILE__) . "/../.."));
     Generator::addGenerator(SkyGridGenerator::class, "skygrid");
 }
開發者ID:Falkirks,項目名稱:SkyGridGenerator,代碼行數:5,代碼來源:Plugin.php

示例14: onLoad

 public function onLoad()
 {
     Generator::addGenerator(MineFarmGenerator::class, $this->name = "minefarm");
     $this->getServer()->getLogger()->info("[MineFarm] MineFarmGenerator is Loaded");
 }
開發者ID:Skull3x,項目名稱:MineBlock,代碼行數:5,代碼來源:MineFarm.php


注:本文中的pocketmine\level\generator\Generator::addGenerator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。