You may find this thread I created earlier useful. After you have a Config instance you can call Config::get($key, $default), Config::set($key, $data) and Config::exists($key) to manage the data. A few examples (building off the thread I linked to): PHP: /** @var pocketmine\utils\Config */public $myConfig;// Assuming we're working from the main and class and it is a registered listenerpublic function onJoin(pocketmine\event\player\PlayerJoinEvent $event) { $player = $event->getPlayer(); $name = $player->getName(); if($this->myConfig->exists($name)) { $player->sendMessage("Welcome back $name!"); // Player has played before and is saved to the config } else { $player->sendMessage("Welcome to this server $name!"); // Player hasn't played before and isn't saved to the config $this->myConfig->set($name, true); $this->myConfig->save(true); // Save the config file asynchronously }}
Thanks a lot guys! But i need tips in adding playername using command /add (name) and save it to config.yml
You have already been given an example for how to store it in a config.yml. What else do you need? If you need help with handling commands, take a look at this.