本文整理汇总了PHP中pocketmine\utils\Config::setAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::setAll方法的具体用法?PHP Config::setAll怎么用?PHP Config::setAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\Config
的用法示例。
在下文中一共展示了Config::setAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveChests
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();
}
示例2: removeZone
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;
}
示例3: saveSession
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();
}
示例4: saveYml
public function saveYml()
{
ksort($this->nn);
$nn = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "NickName.yml", Config::YAML, []);
$nn->setAll($this->nn);
$nn->save();
}
示例5: saveYml
public function saveYml()
{
$fly = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "Fly.yml", Config::YAML);
$fly->setAll($this->fly);
$fly->save();
$this->loadYml();
}
示例6: savePlayer
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();
}
示例7: saveYml
public function saveYml()
{
asort($this->si);
$si = new Config($this->getServer()->getDataPath() . "/plugins/! MineBlock/" . "SubInventory.yml", Config::YAML);
$si->setAll($this->si);
$si->save();
}
示例8: onRun
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!");
}
示例9: saveInventory
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;
}
示例10: saveConfig
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();
}
示例11: cfgSave
/**
* 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();
}
示例12: onDisable
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();
}
示例13: onDisable
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();
}
示例14: 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();
}
示例15: saveClans
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();
}