Look at my code I want add player name to config when join arena, it do not add anything.... PHP: public function getPlayers($arena){ $config = new Config($this->getDataFolder()."Arenas/".$arena.".yml", Config::YAML); $playersXXX = $config->get("Players"); $players = array(); foreach ($playersXXX as $x){ if($x != "steve steve"){ $players[] = $x; } } return $players;public function addPlayerToArena($arena, $name){ $config = new Config($this->getDataFolder()."Arenas/".$arena.".yml", Config::YAML); $players = $this->getPlayers($arena); $players[] = $name; $config->set("Players", $players); $config->save();}} When player join i use addPlayerToArena function
I can't find an error here, allthough creating configs on each call is much overhead. Are you sure you call addPlayerToArena?
Yes I adding player to arena.. When i change for example $config->set("Players", $players); to $config->set("Players", "test"); It is working
Try define the default value of the YAML file an array. Then when you want to access the config, use the following code: PHP: $v = $this->config->getAll();foreach($players as $name){ $v["players"][] = $name;}$this->config->setAll($v);$this->config->save(); ($v could be anything e.g. $c or $tmp or $cfg, just define the variable yourself)
In my Jail plugin, I mainly use this method to store players' data so you could look into it for reference. https://github.com/hoyinm14mc/Jail/