public function saveChests() { $save = []; foreach ($this->chests as $chest) { /** @var ChestPattern $pattern */ $pattern = $chest->getPattern(); $save[] = ["x" => $chest->getPosition()->x, "y" => $chest->getPosition()->y, "z" => $chest->getPosition()->z, "levelName" => $chest->getPosition()->getLevel()->getName(), "patternName" => $pattern::getName(), "patternArgs" => $pattern->getPatternData()]; } $this->config->setAll($save); $this->config->save(); }
public function removeZone(Zone $zone) { $this->zonesConfig->remove($zone->getName()); $permData = $this->permConfig->getAll(false); foreach ($permData as $key => $value) { if (array_key_exists($zone->getName(), $value)) { unset($permData[$key][$zone->getName()]); $this->permConfig->setAll($permData); return true; } } return false; }
private function saveSession() { $values = []; foreach (self::$configDefaults as $k => $v) { if ($k !== "mutedUntil") { $values[$k] = $this->{$k}; } else { // Use '$this->{$k}' so we can later implement more time handlers without problems... $values[$k] = $this->{$k} instanceof \DateTime ? $this->{$k}->getTimestamp() : $v; } } $this->config->setAll($values); $this->config->save(); }
public function saveYml() { ksort($this->nn); $nn = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "NickName.yml", Config::YAML, []); $nn->setAll($this->nn); $nn->save(); }
public function saveYml() { $fly = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "Fly.yml", Config::YAML); $fly->setAll($this->fly); $fly->save(); $this->loadYml(); }
public function savePlayer(IPlayer $player, array $config) { $name = trim(strtolower($player->getName())); $data = new Config($this->plugin->getDataFolder() . "players/" . $name[0] . "/{$name}.yml", Config::YAML); $data->setAll($config); $data->save(); }
public function saveYml() { asort($this->si); $si = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "SubInventory.yml", Config::YAML); $si->setAll($this->si); $si->save(); }
public function onRun($currentTick) { $config = new Config($this->getOwner()->getDataFolder() . "dispensers.yml", Config::YAML); $config->setAll($this->getOwner()->getDispenserList()); $config->save(); $this->getOwner()->getLogger()->info(TextFormat::AQUA . "Auto-saved!"); }
public function saveInventory(Player $player, Inventory $inv) { $n = trim(strtolower($player->getName())); if ($n === "") { return false; } $d = substr($n, 0, 1); if (!is_dir($this->getDataFolder() . $d)) { mkdir($this->getDataFolder() . $d); } $path = $this->getDataFolder() . $d . "/" . $n . ".yml"; $cfg = new Config($path, Config::YAML); $yaml = $cfg->getAll(); if ($this->isGlobal) { $ln = "*"; } else { $ln = trim(strtolower($player->getLevel()->getName())); } $yaml[$ln] = []; foreach ($inv->getContents() as $slot => &$item) { $yaml[$ln][$slot] = implode(":", [$item->getId(), $item->getDamage(), $item->getCount()]); } $inv->clearAll(); $cfg->setAll($yaml); $cfg->save(); return true; }
public function saveConfig() { $this->mineData->setAll([]); foreach ($this->mines as $n => $mine) { $this->mineData->set($n, [$mine->getA()->getX(), $mine->getB()->getX(), $mine->getA()->getY(), $mine->getB()->getY(), $mine->getA()->getZ(), $mine->getB()->getZ(), count($mine->getData()) > 0 ? $mine->getData() : false, $mine->getLevel()->getName()]); } $this->mineData->save(); }
/** * Save a config section to the plugins' config.yml * * @param str $key - section to save * @param mixed $settings - settings to save */ public function cfgSave($key, $settings) { $cfg = new Config($this->getDataFolder() . "config.yml", Config::YAML); $dat = $cfg->getAll(); $dat[$key] = $settings; $cfg->setAll($dat); $cfg->save(); }
public function onDisable() { $config = new Config($this->getDataFolder() . "donators.yml", Config::YAML, array()); $config->setAll($this->donators); $config->save(); $kits = new Config($this->getDataFolder() . "kits.yml", Config::YAML, array()); $kits->setAll($this->kits); $kits->save(); }
public function onDisable() { $save = new Config($this->getDataFolder() . "GambleDB.yml", Config::YAML); $save->setAll($this->db); $save->save(); $save = new Config($this->getDataFolder() . "lotto.yml", Config::YAML); $save->setAll($this->lotto); $save->save(); }
public function save() { $config = new Config($this->path . "protects.yml", Config::YAML); $config->setAll($this->yml); $config->save(); $config = new Config($this->path . "options.yml", Config::YAML); $config->setAll($this->option); $config->save(); }
public function saveClans() { $clansConfig = new Config($this->getDataFolder() . "clans.yml", Config::YAML); $clans = []; foreach ($this->getClans() as $clan) { $clans[$clan->getName()] = $clan->toArray(); } $clansConfig->setAll($clans); $clansConfig->save(); }
public function saveShops() { $shops = $this->shops; foreach ($shops as $loc => $data) { $shops[$loc]["case"] = ""; } $conf = new Config($this->getDataFolder() . "shops.yml", Config::YAML); $conf->setAll($shops); $conf->save(); }
public function onDisable() { $save = new Config($this->getDataFolder() . "database.yml", Config::YAML); $save->setAll($this->db); $save->save(); if ($this->interlocker->dummyPlayer instanceof DummyPlayer) { $this->interlocker->dummyPlayer->loggedIn = false; $this->interlocker->dummyPlayer->close(); } }
private function fixOldConfig() { $tempData = $this->config->getAll(); $version = $this->getDescription()->getVersion(); $tempData["version"] = $version; if (!isset($tempData["default-factions-plugin"])) { $tempData["default-factions-plugin"] = null; } if (isset($tempData["enable-multiworld-support"])) { $tempData["enable-multiworld-chat"] = $tempData["enable-multiworld-support"]; unset($tempData["enable-multiworld-support"]); } if (isset($tempData["custom-no-fac-message"])) { unset($tempData["custom-no-fac-message"]); } if (isset($tempData["groups"])) { foreach ($tempData["groups"] as $groupName => $tempGroupData) { if (isset($tempGroupData["default-chat"])) { $tempGroupData["chat"] = $this->fixOldData($tempGroupData["default-chat"]); unset($tempGroupData["default-chat"]); } else { $tempGroupData["chat"] = $this->fixOldData($tempGroupData["chat"]); } if (isset($tempGroupData["default-nametag"])) { $tempGroupData["nametag"] = $this->fixOldData($tempGroupData["default-nametag"]); unset($tempGroupData["default-nametag"]); } else { $tempGroupData["nametag"] = $this->fixOldData($tempGroupData["nametag"]); } if (isset($tempGroupData["worlds"])) { foreach ($tempGroupData["worlds"] as $worldName => $worldData) { if (isset($worldData["default-chat"])) { $worldData["chat"] = $this->fixOldData($worldData["default-chat"]); unset($worldData["default-chat"]); } else { $worldData["chat"] = $this->fixOldData($worldData["chat"]); } if (isset($worldData["default-nametag"])) { $worldData["nametag"] = $this->fixOldData($worldData["default-nametag"]); unset($worldData["default-nametag"]); } else { $worldData["nametag"] = $this->fixOldData($worldData["nametag"]); } $tempGroupData["worlds"][$worldName] = $worldData; } } $tempData["groups"][$groupName] = $tempGroupData; } } $this->config->setAll($tempData); $this->config->save(); $this->config->reload(); $this->getLogger()->notice("Upgraded PureChat config.yml to the latest version"); }
private function saveSession() { $values = []; foreach (self::$configDefaults as $k => $v) { switch ($k) { case "mutedUntil": $v = $this->{$k} instanceof \DateTime ? $this->{$k}->getTimestamp() : null; break; case "homes": $v = $this->encodeHomes(); break; default: $v = $this->{$k}; break; } $values[$k] = $v; } $this->config->setAll($values); $this->config->save(); }
public function updatePerms() { foreach ($this->getServer()->getPluginManager()->getPermissions() as $perm) { if (!$this->permsConfig->exists($perm->getName(), true)) { $this->permsConfig->set(strtolower($perm->getName()), $this->getDefaultIndex($perm->getDefault())); } } $all = $this->permsConfig->getAll(); asort($all, SORT_FLAG_CASE | SORT_NATURAL); $this->permsConfig->setAll($all); }
public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) { switch ($cmd->getName()) { case "stafflist": if (count($args) != 0) { return false; } $staff = $this->reload(); foreach (["owner" => "Owners", "admins" => "Admins", "mods" => "Moderators", "trusted" => "Trusted"] as $i => $j) { $sender->sendMessage("[StaffList] {$j}: " . implode(", ", $staff[$i])); } return true; case "staffadd": if (count($args) != 2) { return false; } switch (strtolower($args[0])) { case "owner": case "o": $lst = "owner"; break; case "admins": case "admin": case "a": $lst = "admin"; break; case "moderators": case "mod": case "moderator": case "mods": case "m": $lst = "mods"; break; case "trusted": case "t": $lst = "trusted"; break; default: return false; } $target = $args[1]; $staff = $this->reload(); $staff[$lst][] = $target; $yaml = new Config($this->getDataFolder() . "staff.yml", Config::YAML, []); $yaml->setAll($staff); $yaml->save(); $sender->sendMessage("{$target} added to {$lst} list"); return true; } return false; }
/** * Save plug-in database * * @param boolean $async */ public function save($async = false) { $save = new Config($this->getPlugin()->getDataFolder() . "pluginDB.json", Config::JSON); $save->setAll($this->db); $save->save($async); }
public function onDisable() { $company = new Config($this->getDataFolder() . "Company.json", Config::JSON); $company->setAll($this->CompanyDB); $company->save(); }
public function saveFloats() { $path = $this->owner->getDataFolder() . "floats.yml"; $cf = []; foreach ($this->cfgtxt as $world => $txts) { $cf[$world] = []; foreach ($txts as $item) { $cf[$world][] = ["pos" => implode(":", $item["pos"]), "text" => $item["text"]]; if ($item["opts"] !== null) { $cf[$world][count($cf[$world]) - 1]["opts"] = $item["opts"]; } } } $yml = new Config($path, Config::YAML, []); $yml->setAll($cf); $yml->save(); }
/** * * @see \pocketmine\plugin\PluginBase::onDisable() */ public function onDisable() { /* Save Plug-in Config data */ $save = new Config($this->getDataFolder() . "pluginDB.yml", Config::YAML); $save->setAll($this->db); $save->save(); foreach ($this->getServer()->getOnlinePlayers() as $onlinePlayer) { if (!$onlinePlayer instanceof DummyPlayer) { continue; } if (!isset($allPlayerList[$onlinePlayer->getName()])) { $onlinePlayer->loggedIn = false; $onlinePlayer->close(); } } }
public function save() { $moneyConfig = new Config($this->getDataFolder() . "Money.yml", Config::YAML); $moneyConfig->setAll($this->money); $moneyConfig->save(); file_put_contents($this->getDataFolder() . "PlayerLang.dat", serialize($this->playerLang)); }
/** * Save plug-in database * * @param boolean $async */ public function save($async = false) { $save = new Config($this->getPlugin()->getDataFolder() . "TAG_DB.yml", Config::YAML); $save->setAll($this->db); $save->save($async); }
public function save() { $config = new Config($this->path, Config::YAML); $config->setAll($this->land); $config->save(); }
public function save() { $pluginDB = new Config($this->getDataFolder() . "pluginDB.json", Config::JSON); $pluginDB->setAll($this->pluginDB); $pluginDB->save(); }
public function saveSigns() { $path = $this->getDataFolder() . "signs.yml"; $yml = new Config($path, Config::YAML, []); $yml->setAll($this->signsCfg); $yml->save(); }