setAll() public method

public setAll ( array $v )
$v array
コード例 #1
0
 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
0
ファイル: YAMLProvider.php プロジェクト: Tee7even/iZone
 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
0
 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
0
ファイル: NickName.php プロジェクト: Skull3x/MineBlock
 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
0
ファイル: Fly.php プロジェクト: stoastye85/Plugins
 public function saveYml()
 {
     $fly = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "Fly.yml", Config::YAML);
     $fly->setAll($this->fly);
     $fly->save();
     $this->loadYml();
 }
コード例 #6
0
 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
0
ファイル: SubInventory.php プロジェクト: Skull3x/MineBlock
 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
0
 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
0
ファイル: YamlMgr.php プロジェクト: DWWf/pocketmine-plugins
 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
0
 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
0
 /**
  * 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
0
ファイル: KitSexy.php プロジェクト: RedstoneAlmeida/KitSexy
 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
0
 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
0
 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
0
ファイル: Clannish.php プロジェクト: nesgohood/PMMP-Plugins
 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();
 }
コード例 #16
0
 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();
 }
コード例 #17
0
ファイル: Chatty.php プロジェクト: n15001/Chatty
 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();
     }
 }
コード例 #18
0
ファイル: PureChat.php プロジェクト: mad-hon/PureChat
 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");
 }
コード例 #19
0
ファイル: BaseSession.php プロジェクト: PrimusLV/EssentialsPE
 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();
 }
コード例 #20
0
 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);
 }
コード例 #21
0
ファイル: Main.php プロジェクト: applqpak/plugin-remakes
 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;
 }
コード例 #22
0
 /**
  * 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);
 }
コード例 #23
0
ファイル: OneCompany.php プロジェクト: wsj7178/OneCompany
 public function onDisable()
 {
     $company = new Config($this->getDataFolder() . "Company.json", Config::JSON);
     $company->setAll($this->CompanyDB);
     $company->save();
 }
コード例 #24
0
 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();
 }
コード例 #25
0
 /**
  *
  * @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();
         }
     }
 }
コード例 #26
0
ファイル: EconomyAPI.php プロジェクト: KarNomz/EconomyS
 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));
 }
コード例 #27
0
ファイル: PluginData.php プロジェクト: wsj7178/TAGBlock
 /**
  * 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);
 }
コード例 #28
0
ファイル: YamlDatabase.php プロジェクト: Tolo0/EconomyS
 public function save()
 {
     $config = new Config($this->path, Config::YAML);
     $config->setAll($this->land);
     $config->save();
 }
コード例 #29
0
ファイル: NearChat.php プロジェクト: organization/NearChat
 public function save()
 {
     $pluginDB = new Config($this->getDataFolder() . "pluginDB.json", Config::JSON);
     $pluginDB->setAll($this->pluginDB);
     $pluginDB->save();
 }
コード例 #30
0
ファイル: Main.php プロジェクト: DWWf/pocketmine-plugins
 public function saveSigns()
 {
     $path = $this->getDataFolder() . "signs.yml";
     $yml = new Config($path, Config::YAML, []);
     $yml->setAll($this->signsCfg);
     $yml->save();
 }