当前位置: 首页>>代码示例>>PHP>>正文


PHP Block::init方法代码示例

本文整理汇总了PHP中pocketmine\block\Block::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::init方法的具体用法?PHP Block::init怎么用?PHP Block::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\block\Block的用法示例。


在下文中一共展示了Block::init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onRun

 public function onRun()
 {
     Block::init();
     Biome::init();
     $manager = new SimpleChunkManager($this->seed);
     $this->saveToThreadStore("generation.level{$this->levelId}.manager", $manager);
     /** @var Generator $generator */
     $generator = $this->generator;
     $generator = new $generator($this->settings);
     $generator->init($manager, new Random($manager->getSeed()));
     $this->saveToThreadStore("generation.level{$this->levelId}.generator", $generator);
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:12,代码来源:GeneratorRegisterTask.php

示例2: __construct


//.........这里部分代码省略.........
     $this->levelMetadata = new LevelMetadataStore();
     $this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
     $this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
     if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
         @rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
     }
     @touch($this->dataPath . "banned-players.txt");
     $this->banByName = new BanList($this->dataPath . "banned-players.txt");
     $this->banByName->load();
     @touch($this->dataPath . "banned-ips.txt");
     $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);
开发者ID:ZenaGamingsky,项目名称:PocketBox,代码行数:67,代码来源:Server.php

示例3: __construct


//.........这里部分代码省略.........
         if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
             @rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
         }
         @touch($this->dataPath . "banned-players.txt");
         $this->banByName = new BanList($this->dataPath . "banned-players.txt");
         $this->banByName->load();
         @touch($this->dataPath . "banned-ips.txt");
         $this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
         $this->banByIP->load();
         @touch($this->dataPath . "banned-cids.txt");
         $this->banByCID = new BanList($this->dataPath . "banned-cids.txt");
         $this->banByCID->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(), $this->getPocketMineVersion(), $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(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")) {
开发者ID:xuxugzs,项目名称:Genisys,代码行数:67,代码来源:Server.php

示例4: __construct


//.........这里部分代码省略.........
     if (($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false) {
         $value = ["M" => 1, "G" => 1024];
         $real = (int) substr($memory, 0, -1) * $value[substr($memory, -1)];
         if ($real < 128) {
             $this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0);
         }
         @ini_set("memory_limit", $memory);
     } else {
         $this->setConfigString("memory-limit", "256M");
     }
     $this->network = new Network($this);
     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);
     }
     define("ADVANCED_CACHE", $this->getProperty("settings.advanced-cache", false));
     if (ADVANCED_CACHE == true) {
         $this->logger->info("Advanced cache enabled");
     }
     Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 8);
     if (defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0) {
         @\cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
     }
     $this->logger->info("Starting Minecraft PE server on " . ($this->getIp() === "" ? "*" : $this->getIp()) . ":" . $this->getPort());
     define("BOOTUP_RANDOM", @Utils::getRandomBytes(16));
     $this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
     $this->addInterface($this->mainInterface = new RakLibInterface($this));
     $this->logger->info("This server is running " . $this->getName() . " version " . ($version->isDev() ? TextFormat::YELLOW : "") . $version->get(true) . TextFormat::WHITE . " \"" . $this->getCodename() . "\" (API " . $this->getApiVersion() . ")");
     $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;
             }
         }
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:67,代码来源:Server.php

示例5: __construct


//.........这里部分代码省略.........
         $this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
         $this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
         if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
             @rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
         }
         @touch($this->dataPath . "banned-players.txt");
         $this->banByName = new BanList($this->dataPath . "banned-players.txt");
         $this->banByName->load();
         @touch($this->dataPath . "banned-ips.txt");
         $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));
         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);
         }
开发者ID:robske110,项目名称:ClearSky,代码行数:67,代码来源:Server.php


注:本文中的pocketmine\block\Block::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。