im trying to make a permissions plugin and i have my config file saved like this with rank player and voyager Error: Invalid args supplied for foreach() PHP: ---player:- core.testpermission- core.testpermissionvoyager:- core.testpermission- core.testpermission... why is this not working? PHP: $config = new Config(Core::getInstance()->getDataFolder() . "Permissions.yml", Config::YAML); $oldperms = $config->get($this->getRank()); //getRank() returns players rank foreach($oldperms as $oldperm){ $this->addAttachment(Core::getInstance(), $oldperm, false); }
PHP: $data = new Config(Core::getInstance()->getDataFolder()."Permissions.yml", Config::YAML, []);$rank = $this->getRank();foreach($data->get($rank) as $perm){///......}//Verify If $this->getRank() returns real rank of player ..I/PHP]
there is a couple of things you need to account the config has not been previously set up and will be emtpy the path you provided may not be the location of the config getRank() does not properly return the string you want your config does not have the rank set up