I'm learning to add stuff to configs so how would I get the data Under a username and get the Data under that would it be PHP: $player->get($player->getName())->get("Keys");
PHP: $config = new Config($this->plugin->getDataFolder() . $player->iusername . ".yml", Config::YAML, array("thing" => "hello"));$config->get("thing"); //returns hello Modifying will be like PHP: $config->set("thing", "bye");$config->save();
Add an array into the config PHP: /** @var \pocketmine\utils\Config */$config->set("mainKey", ['usernames' => ['bill', 'bob']]);$config->save();$bill = $config->get('mainKey')['usernames'][0];$bob = $config->get('mainKey')['usernames'][1];
Call the config class again with a different file name and save it to have more then one config file.
For a different file you would need to create a new instance of the Config class and set the new files data to the data of the old file. ex) PHP: <?php$oldConfig = new \pocketmine\utils\Config('pathToOldFile', \pocketmine\utils\Config::YAML);$newConfig = new \pocketmine\utils\Config('pathToNewFile', \pocketmine\utils\Config::YAML, $oldConfig->getAll());$newConfig->save();
would this work PHP: <?php $this->players = new Config($this->getDataFolder() . "Players.yml", Config::YAML);
if I do that would I need to add a folder to resources with the name or would it automatically make it for me
Depends If You Want To Get From The Resource Folder Or From The Code It Self. Make The Config Manually From The Code PHP: //example$this->conf = new Config($this->getDataFolder() . "ConfigName.yml", CONFIG::YAML, array("FromCode" => "ItWillMakeTheFileItself")); Get The Config From resources folder PHP: //example 2$this->getResource("FromResourcesFolder.yml"); // get Resources$this->saveResource("FromResourcesFolder.yml"); // save the resource to the Folder$this->fromres = new Config($this->getDataFolder() . "FromResourcesFolder.yml");// let fromres to act as the conf Note: This just example