/** * @param Player $player * @param int $flag * @param bool $default * @param bool $partial * @param Position|null $loc * @return bool */ private function areaHasFlag(Player $player, $flag, $default, $partial = true, $loc = null) { if (!$loc instanceof Position) { $loc = $player; } $area = $this->main->getDatabase()->searchAreaByPosition($loc); return $area instanceof Area ? $area->hasFlag($player->getName(), $flag, $partial) : $default; }
public function init($args) { $this->indexFile = $args["index-file"]; $this->areaFile = $args["area-file"]; $dir = dirname($this->indexFile); if (!is_dir($dir)) { mkdir($dir, 0777, true); } elseif (is_file($this->indexFile)) { $c = file_get_contents($this->indexFile); foreach (explode("", $c) as $name) { try { $this->areas[$name] = $this->loadArea($name); } catch (\RuntimeException $e) { $this->main->getLogger()->error("Failed to load area of name '{$name}': {$e->getMessage()}"); } } } }