pocketmine\permission\BanList::load PHP Метод

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

public load ( )
    public function load()
    {
        $this->list = [];
        $fp = @fopen($this->file, "r");
        if (is_resource($fp)) {
            while (($line = fgets($fp)) !== false) {
                if ($line[0] !== "#") {
                    $entry = BanEntry::fromString($line);
                    if ($entry instanceof BanEntry) {
                        $this->list[$entry->getName()] = $entry;
                    }
                }
            }
            fclose($fp);
        } else {
            MainLogger::getLogger()->error("Could not load ban list");
        }
    }

Usage Example

Пример #1
0
 public function reload()
 {
     $this->logger->info("Saving levels...");
     foreach ($this->levels as $level) {
         $level->save();
     }
     $this->pluginManager->disablePlugins();
     $this->pluginManager->clearPlugins();
     $this->commandMap->clearCommands();
     $this->logger->info("Reloading properties...");
     $this->properties->reload();
     $this->maxPlayers = $this->getConfigInt("max-players", 20);
     if ($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3) {
         $this->setConfigInt("difficulty", 3);
     }
     $this->banByIP->load();
     $this->banByName->load();
     $this->reloadWhitelist();
     $this->operators->reload();
     $this->memoryManager->doObjectCleanup();
     foreach ($this->getIPBans()->getEntries() as $entry) {
         $this->getNetwork()->blockAddress($entry->getName(), -1);
     }
     $this->pluginManager->registerInterface(PharPluginLoader::class);
     $this->pluginManager->registerInterface(ScriptPluginLoader::class);
     $this->pluginManager->loadPlugins($this->pluginPath);
     $this->enablePlugins(PluginLoadOrder::STARTUP);
     $this->enablePlugins(PluginLoadOrder::POSTWORLD);
     TimingsHandler::reload();
 }
All Usage Examples Of pocketmine\permission\BanList::load